note 40261 added to function.mysql-list-fields
| From: | mattwheaton at hotmail dot com | Date: | Thu, 26 Feb 2004 19:55:45 +0000 |
| Subject: | note 40261 added to function.mysql-list-fields | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-65830@lists.php.net to get a copy of this message | ||
this is a function that returns an array containing the field names in a table
<?php
function getFieldNames($table, $link){
$rslt = mysql_query("SELECT * FROM $table", $link);
$fieldnames = array();
for ($i = 0; $i < mysql_num_fields($rslt); $i++){
array_push($fieldnames, mysql_field_name($rslt, $i));
}
return $fieldnames;
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.mysql-list-fields.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40261
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40261&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40261&report=yes
Search -- http://master.php.net/manage/user-notes.php