title: Get Only column names as in array mysql
body: <p>I am new in both php and mysql. I want to create a dynamic table that will have all fields from table in mysql database. I am trying to get all column names in an array but fail to do. I am trying following code:</p>
  
  <pre><code>&lt;?php
      $fields = mysql_query("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'mytablename' ");
      $res = mysql_fetch_array($fields);
      foreach ($res as $field)
      {
          echo '&lt;tr&gt;';
          echo '&lt;td&gt;';
          echo $field;
          echo '&lt;/td&gt;';
          echo '&lt;td&gt;';
          echo "&lt;input type='text' class='' name='tags' id='tags' value=''&gt;";
          echo '&lt;/td&gt;';
          echo '&lt;/tr&gt;';
      }
      ?&gt;
  </code></pre>
  
  <p>Any assistance would be appreciated.</p>