If have and array called food (generated by form checkboxes) in which each items in that array is in its own mysql database row with another entry called price. I would like to create a second array for the prices.
I have written this code to display each price of all the item in my food array.
Having them list is fine, but I would like them to be in an array so I can easily add them up. How can I change it so it will put all the prices into an array.
Thanks.Code:foreach($food as $foodarray) { $result = mysql_query("SELECT * FROM menu WHERE name='".$foodarray."'"); while($row = mysql_fetch_array($result)) { echo $row['price'], " "; } }



Reply With Quote


Bookmarks