note 30739 deleted from function.mysql-fetch-field by danbrown

From: Date: Sat, 20 Jun 2009 02:16:53 +0000
Subject: note 30739 deleted from function.mysql-fetch-field by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-157161@lists.php.net to get a copy of this message
Note Submitter: blakjak at nospam dot com ---- mysql_fetch_field will fail if your result set's internal pointer has advanced past the end of the result. So, if you use ... $result = mysql_query("select * from person where id=1"); // returns 1 row $row = mysql_fetch_row($result); while($field = mysql_fetch_field){ echo $field->name; } ... you won't see any fields. If you need to use mysql_fetch_field, you need to do it before you've iterated through all the rows in the result set.

« previous php.notes (#157161) next »