Monday, 6 June 2016

mysql - php while loop + where


list table






  • id

  • name

  • illness

  • recipe

  • directions



    $illness = 'Highblood';

    $list = mysql_query("SELECT * FROM list ",$con);
    while($row=mysql_fetch_array($list, MYSQL_ASSOC)){
    $test[] = $row['recipe'];
    $test2[] = $row['directions'];
    }



I want to only get the rows





  • $row['recipe'];

  • $row['directions'];



if the value of illness column is equals to highblood.
how do I do this?

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...