note 26114 deleted from function.pg-fetch-array by irchtml
| From: | irchtml@php.net | Date: | Sun, 09 Jan 2005 16:49:39 +0000 |
| Subject: | note 26114 deleted from function.pg-fetch-array by irchtml | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-82997@lists.php.net to get a copy of this message | ||
Note Submitter: Terry Wogan
----
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 ...
}