title: Displaying all records in a mysql table
body: <p>The code below works fine for printing one record from a database table, but what I really want to be able to do is print all the records in the mysql table in a format similar to my code.</p>
  
  <p>I.E.: Field Name as heading for each column in the html table and the entry below the heading.  Hope this is making sense to someone ;)</p>
  
  <pre><code>        $raw = mysql_query("SELECT * FROM tbl_gas_meters");
          $allresults = mysql_fetch_array($raw);
          $field = mysql_query("SELECT * FROM tbl_gas_meters");
          $num_fields = mysql_num_fields($raw);   
          $num_rows = mysql_num_rows($raw);   
          $i = 1;
  
              print "&lt;table border=1&gt;\n";
              while ($i &lt; $num_fields)
              {
                  echo "&lt;tr&gt;";
                  echo "&lt;b&gt;&lt;td&gt;" . mysql_field_name($field, $i) . "&lt;/td&gt;&lt;/b&gt;";
                  //echo ": ";
                  echo '&lt;td&gt;&lt;font color ="red"&gt;' . $allresults[$i] . '&lt;/font&gt;&lt;/td&gt;';
                  $i++;
                  echo "&lt;/tr&gt;";
                  //echo "&lt;br&gt;";
              }
              print "&lt;/table&gt;";
  </code></pre>