title: How do I print columns selected from a query in MySQL in PHP?
body: <p>This confounds me. I for example I have a certain record in a table <em>yes</em> in MySQL.</p>
  
  <pre><code>     | name | pizza |  burger | fries |  sundae  |
     1 | boo  |   0   |    0    |   1   |    2     |
  </code></pre>
  
  <p>To print this table MANUALLY:</p>
  
  <pre><code>mysql_select_db("my_db", $con);
  
  $result = mysql_query("SELECT * FROM yes WHERE name = 'boo' ");
  
  while($row = mysql_fetch_array( $result ))
  {
      echo $row['name'];
      echo "&lt;br /&gt;";
      echo $row['fries'];
      echo $row['sundae'];
  }
  </code></pre>
  
  <p>So, I know only fries would have a non-zero value, so its the only column value I echoed. Would there be any way to loop through all the columns in the query without echoing the columns manually?</p>
  
  <p>For example, if I had 100 food items and only 69 had a non-zero value, does that mean I'd have to echo one by one all the columns in the loop?</p>
  
  <p>Ideally, I'd want the PHP to show only the name and the food item ordered that has a non-zero value.</p>
  
  <p>The output would be something like 
  Boo, you have ordered 1 fries, 2 sundaes, n food, and so on.</p>
  
  <p>Working with MySQL and PHP.</p>