php - How to echo multiple results from database -


how echo multiple results. displays recipe names want able echo steps database well. field in database step 1.

 <?php     if (isset($_post['search'])) {         $ingredient1 = $_post['dropdown1'];         $ingredient2 = $_post['dropdown2'];         $ingredient3 = $_post['dropdown3'];          $recipes = mysql_query("             select distinct `name`             `recipe` r             inner join `recipe_ingredients` ri             on r.id = ri.recipe_id             ri.ingredient_id in (".$ingredient1.",".$ingredient2.",".$ingredient3.")         ");         echo '<section id="results">';         while ($recipe = mysql_fetch_assoc($recipes)) {             echo $recipe['name'].'<br />';         }     }     echo '</section>';     ?> 

this threw error. : php parse error: syntax error, unexpected ',', expecting ']' in \pdc3\sites\c\cupboard2stomach.com\public_html\php\get.php on line 97

echo $recipe['name'].'<br />'; echo $recipe['step1'].'<br />'; 

no error doesn't display results.

 echo $recipe['name','step1'].'<br />'; 

enter image description here recipe table

enter image description here

echo '<section id="results">';     while ($recipe = mysql_fetch_assoc($recipes)) {         echo $recipe['name'].'<br />';         echo $recipe['step1'].':','<br />';         echo $recipe['step2'].':','<br />';         echo $recipe['step3'].':','<br />';       } } echo '</section>'; 

these results back

select r.`name`, r.`step1` `recipe` r inner join `recipe_ingredients` ri on r.id = ri.recipe_id ri.ingredient_id in ('".$ingredient1."', '".$ingredient2."', '".$ingredient3."') group r.`name` 

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -