note 40258 deleted from function.mysql-num-fields by irchtml
| From: | irchtml@php.net | Date: | Thu, 26 Feb 2004 19:53:31 +0000 |
| Subject: | note 40258 deleted from function.mysql-num-fields by irchtml | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-65827@lists.php.net to get a copy of this message | ||
Note Submitter: mattwheaton@hotmail.com
----
this function returns an array with the list of field names in a specific table:
<?php
function getFieldNames($table, $link){
$rslt = mysql_query("SELECT * FROM $table", $link);
$fields = array();
for ($i = 0; $i < mysql_num_fields($rslt); $i++){
array_push($fields, mysql_field_name($rslt, $i));
}
return $fields;
}
?>