note 40261 deleted from function.mysql-list-fields by nlopess
| From: | nlopess@php.net | Date: | Thu, 26 Feb 2004 21:34:10 +0000 |
| Subject: | note 40261 deleted from function.mysql-list-fields by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-65848@lists.php.net to get a copy of this message | ||
Note Submitter: mattwheaton@hotmail.com
----
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;
}
?>