note 40258 added to function.mysql-num-fields

From: Date: Thu, 26 Feb 2004 19:52:06 +0000
Subject: note 40258 added to function.mysql-num-fields
Groups: php.notes 
Request: Send a blank email to php-notes+get-65824@lists.php.net to get a copy of this message
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; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.mysql-num-fields.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+40258 Delete -- http://master.php.net/manage/user-notes.php?action=delete+40258&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+40258&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#65824) next »