View Single Post
  #2 (permalink)  
Old 07-22-2008, 08:55 PM
curtiss's Avatar
curtiss curtiss is offline
Moderator
 
Join Date: May 2003
Posts: 1,438
You can run either of the following queries:
PHP Code:
DESC $table
or
PHP Code:
SHOW COLUMNS FROM $table 
Both queries will return the same results. Within those results, the column that you want will be called "Field".

Therefore, your PHP might look something like:
PHP Code:
$cols = array();
if(
$sql mysql_query("DESC mytable",$link)) {
while(
$rows mysql_fetch_assoc($sql)) {
$cols[] = $rows['Field'];
}

__________________
I hate Internet Explorer! Anyone with me?
Reply With Quote