note 36861 added to function.pg-fetch-assoc

From: Date: Fri, 24 Oct 2003 22:35:10 +0000
Subject: note 36861 added to function.pg-fetch-assoc
Groups: php.notes 
Request: Send a blank email to php-notes+get-59263@lists.php.net to get a copy of this message
An important thing to note (as of PHP 4.3.2): If you are used to using the "extended" comparision operators (=== and !==) to try to make your code easier to follow visually, this function will return NULL if the provided resource handle is invalid (as opposed to false). ie, $rs = @pg_query('SELECT * FROM fake_table'); while (false !== ($row = @pg_fetch_assoc($rs))) { print_r($row); } Obviously you should check to see if $rs === false before you start the while loop, but this example is used to illustrate a potential infinite loop problem if $rs IS false. ---- Manual Page -- http://www.php.net/manual/en/function.pg-fetch-assoc.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+36861 Delete -- http://master.php.net/manage/user-notes.php?action=delete+36861&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+36861&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#59263) next »