I\'d like to get all of a mysql table\'s col names into an array in php?
Is there a query for this?
function get_col_names(){ $sql = "SHOW COLUMNS FROM tableName"; $result = mysql_query($sql); while($record = mysql_fetch_array($result)){ $fields[] = $record['0']; } foreach ($fields as $value){ echo 'column name is : '.$value.'-'; } } return get_col_names();