title: Excluding a column in a foreach table without losing the data
body: <p>I need to stop the ID column from displaying in a foreach table generated in html/php but at the same time I still need to refer to the data to edit by ID. Here is the code.</p>
  
  <pre><code>$queryz = "SELECT * FROM box WHERE date=CURDATE()";
  
      print "&lt;table&gt; ";
      $result = mysqli_query($db,$queryz);
      //return only the first row (we only need field names)
      $row = $result-&gt;fetch_assoc();  
      print " &lt;tr&gt; ";
      foreach ($row as $field =&gt; $value){
      print " &lt;th&gt;$field&lt;/th&gt; ";
      } // end foreach
      print " &lt;/tr&gt; ";
      //second query gets the data
      $data = $result;
      $data-&gt;fetch_assoc();
      foreach($data as $row){
      print " &lt;tr&gt; ";
      foreach ($row as $name=&gt;$value){
      print " &lt;td&gt;$value&lt;/td&gt; ";
  
      } // end field loop
      echo '&lt;td&gt;&lt;a href="edit.php?id=' . $row['ID'] . '"&gt;Edit&lt;/a&gt;&lt;/td&gt;';
      echo '&lt;td&gt;&lt;a href="print.php?id=' . $row['ID'] . '"&gt;Print&lt;/a&gt;&lt;/td&gt;';
      print " &lt;/tr&gt; ";
      } // end record loop
  </code></pre>
  
  <p>I want it to grab all the columns, but not display the ID column. I still need the ID Data so I can edit the table: <code>echo '&lt;td&gt;&lt;a href="edit.php?id=' . $row['ID'] . '"&gt;Edit&lt;/a&gt;&lt;/td&gt;';</code></p>
  
  <p>Thanks guys! I've tried filtering via if arrays and excluding the data in the SQL but it won't let me edit the table afterwards. I'm guessing because it is not grabbing the data in the first place.</p>