title: fetching db column names only, for display in dynamic table using php
body: <p>in the code below Im searching specific columns from a db table and placing them into a html table, inserting &amp;nbsp for empty db fields to maintain uniformed structure. That part works fine, but Im having trouble figuring out the best way to go about getting the column names that are being searched and dynamically displaying them once at the very top of the html table? If my search changes, the column names displayed on the html table will change with it accordingly. Im fairly new to php/mysql and would appreciate any help guys.</p>
  
  <pre><code>$result = mysql_query('SELECT part, ers, make, model, years, oe, core, inlet, outlet FROM parts LIMIT 3');
  echo '&lt;table&gt;';
  while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
      echo '&lt;tr&gt;';
      foreach ($row as $name =&gt; $value) {
          if ( $value == "" ) $value="&amp;nbsp;";
          echo '&lt;td&gt; '.$value.' &lt;/td&gt;'; 
      }
      echo '&lt;/tr&gt;'; 
  }
  echo "&lt;/table&gt;";
  </code></pre>