note 6916 deleted from mysql_list_fields by danbeck
| From: | danbeck@php.net | Date: | Thu, 07 Sep 2000 17:05:22 +0000 |
| Subject: | note 6916 deleted from mysql_list_fields by danbeck | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-4402@lists.php.net to get a copy of this message | ||
<p>It's actually a little more obscure to use. In order to list all the names of the
fields in a table you need:</p>
<p>
$link = mysql_connect($host, $user, $passwd);<br>
$fields = mysql_list_fields($database, $table, $link);<br>
$numCols = mysql_num_fields($fields);<br>
for ($i=0; $i < $numCols; $i++){<br>
print mysql_field_name($fields, $i);<br>
}<br></p>
<p>It seems that a standard function that returns an array of names, or even an object
containing the field names, types, and lengths would be _very_ useful.