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

Recommended Answers

All 2 Replies

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.