$totale=0;
$query="select carrello.*, prodotti.* from carrello as carrello, prodotti as prodotti where prodotto_codice=carrello_FK_prodotto_codice and carrello_ip like '$mio_indirizzo_ip' order by prodotto_nome";
$dati=mysql_db_query( "$database", $query);
$num_totale2 = mysql_numrows ($dati);
while ($row = mysql_fetch_array ($dati))
{
$stringa=$row["prodotto_nome"];
if(strlen($stringa)>30){
$stringa_tagliata=substr($stringa, 0,30);
$last_space=strrpos($stringa_tagliata," ");
$stringa_ok=substr($stringa_tagliata, 0,$last_space);
$stringa=$stringa_ok;
}
?>
"> echo $row["carrello_quantita"]." X ".$stringa;?> |
if ($row["prodotto_prezzoscontato"]<>0) {
$prezzo=$row["prodotto_prezzoscontato"];
}
else {
$prezzo=$row["prodotto_prezzopub"];
} ?>
echo $prezzo*$row["carrello_quantita"]; $totale=$totale+$prezzo*$row["carrello_quantita"];
?> Euro |
} ?>
|
|
|
|
|
if ($num_totale2 > 0) { ?>
Totale: |
echo $totale;?> Euro |
} else { ?>
Il tuo carrello è vuoto |
|
} ?>
if ($num_totale2 > 0) { ?>
compila e concludi l'ordine
} ?>