You can run either of the following queries:
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'];
}
}