note 26114 added to function.pg-fetch-array

From: Date: Fri, 18 Oct 2002 13:16:06 +0000
Subject: note 26114 added to function.pg-fetch-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-38248@lists.php.net to get a copy of this message
Contrary to the note above, you can indeed specify the result type without specifying the row - just pass NULL instead of a row number. I've confirmed this with the PHP 4.2.3 source - I can't vouch for earlier versions. This trick should also work with pg_fetch_object(). Example: $conn = pg_connect("dbname=bobby_davro"); $result = pg_query($conn, "SELECT name FROM sausages"); while ($row = pg_fetch_array($result, NULL, PGSQL_ASSOC)) { print($row["name"]); ... etc ... } -- http://www.php.net/manual/en/function.pg-fetch-array.php http://master.php.net/manage/user-notes.php?action=edit+26114 http://master.php.net/manage/user-notes.php?action=delete+26114 http://master.php.net/manage/user-notes.php?action=reject+26114

« previous php.notes (#38248) next »