in the database the values are posted just fine and correctly.the only thing i need is how to present the choices that is how many times ice cream was chosen or cake. Please help me
[off-topic] @cielonovatus95 welcome to the forums. When you post code in the forum, you need to format it. To do so you can either select all the code and click the </> button, or type 3 backticks ``` on a separate line both before and after the code block.
[/off-topic]
Whereas, if you had normalized the database, it goes a little simpler…and we can use some fancyness.
$foodstore = array();
$dbquery = mysqli_query($db,"SELECT COUNT(name) AS c, name FROM desserts GROUP BY name");
array_walk(mysqli_fetch_all($dbquery,MYSQL_ASSOC), function(v,i) { $foodstore[$v['name']] = $v['c']; });
echo $foodstore['cake'];