note 30739 added to function.mysql-fetch-field
| From: | blakjak at nospam dot com | Date: | Thu, 27 Mar 2003 08:18:57 +0000 |
| Subject: | note 30739 added to function.mysql-fetch-field | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-45879@lists.php.net to get a copy of this message | ||
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.
--
http://www.php.net/manual/en/function.mysql-fetch-field.php
http://master.php.net/manage/user-notes.php?action=edit+30739
http://master.php.net/manage/user-notes.php?action=delete+30739
http://master.php.net/manage/user-notes.php?action=reject+30739