i have found this code and would like to know how i can get the column titles to show up at the top of the page.

$result = mysql_query( "SELECT * FROM merc_users" ) 
or die("SELECT Error: ".mysql_error()); 
$num_rows = mysql_num_rows($result); 
print "There are $num_rows records.<P>"; 
print "<table width=1000 height=400 border=1>\n"; 
while ($get_info = mysql_fetch_row($result)){ 
print "<tr>\n"; 
foreach ($get_info as $field) 
print "\t<td><font face=arial size=2/>$field</font></td>\n"; 
print "</tr>\n"; 
print "</table>\n";

this code simply just prints out all the data without the titles to the columns

10 Years
Discussion Span
Last Post by kevin wood

I think you are looking for the mysql_field_name() function. Have a look here or here.
Keep in mind that in doing this, you are revealing your table layout word-for-word.


i know i am working on a website someone else has built and i need to know all everything about the tables he has created. he made the tables then deleted the code so it is not available to me to update the site

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.