note 55117 deleted from function.mysql-list-fields by danbrown
| From: | danbrown@php.net | Date: | Tue, 05 May 2009 13:37:07 +0000 |
| Subject: | note 55117 deleted from function.mysql-list-fields by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154231@lists.php.net to get a copy of this message | ||
Note Submitter: harryzhong at hotmail dot com
----
Here is a simple script get names of columns in an array:
//Get names of columns in table
$field_names = array();
$res = mysql_query("SHOW COLUMNS FROM
my_table");
for($i=0;$i<mysql_num_rows($res);$i++){
array_push($field_names,mysql_result($res, $i));
}