For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > September 2005 > SHOW only the field names









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author SHOW only the field names
google@charliefortune.com

2005-09-26, 8:00 am

Is there a way using the SHOW or DESCRIBE keywords to list only the
field names, excluding the rest of the information (type, length etc.)

thank you

google@charliefortune.com

2005-09-26, 6:57 pm

I found the answer, here it is if anyone else needs it...

$query="SHOW FIELDS from $table;";
$result=mysql_query($query);
$num_rows=mysql_num_rows($result);
print "$num_rows rows available<br>";
while ($a_row=mysql_fetch_row($result)){
print $a_row[0];
print "<br>";
}

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com