note 55117 added to function.mysql-list-fields
| From: | harryzhong at hotmail dot com | Date: | Tue, 26 Jul 2005 04:27:13 +0000 |
| Subject: | note 55117 added to function.mysql-list-fields | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-92443@lists.php.net to get a copy of this message | ||
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));
}
----
Manual Page -- http://www.php.net/manual/en/function.mysql-list-fields.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+55117
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55117&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55117&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55117&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55117&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55117&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55117&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+55117&report=yes
Search -- http://master.php.net/manage/user-notes.php