Ik heb in mijn tabel producten.
X aantal producten staan.
En daar staat ook in hoeveel keer het verkocht is. Als ik dan per product wil berekenen hoeveel ik heb verdient. Zet ik het in een while. En doe ik: prijs * verkocht.
Maar hoe tel ik dan die prijs van alle producten bij elkaar op??
Moet ik het in een array zetten. En hoe werkt dat dan??
Ik heb dit:
alvast bedankt
X aantal producten staan.
En daar staat ook in hoeveel keer het verkocht is. Als ik dan per product wil berekenen hoeveel ik heb verdient. Zet ik het in een while. En doe ik: prijs * verkocht.
Maar hoe tel ik dan die prijs van alle producten bij elkaar op??
Moet ik het in een array zetten. En hoe werkt dat dan??
Ik heb dit:
[COLOR= #0000BB]<?php $inkomst[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]();[/COLOR]
[URL="http://www.php.net/while"]while[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$iquery[/COLOR][COLOR= #007700])) {[/COLOR]
[COLOR= #0000BB]$inkomst[/COLOR][COLOR= #007700][] =[/COLOR] [COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]verkocht[/COLOR][COLOR= #007700]]*[/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]prijs[/COLOR][COLOR= #007700]];
}[/COLOR] ?> alvast bedankt



05.