cvs: phpdoc /en/reference/pgsql/functions pg-fetch-assoc.xml
| From: | Philip Olson | Date: | Sat, 09 Aug 2003 20:28:18 +0000 |
| Subject: | cvs: phpdoc /en/reference/pgsql/functions pg-fetch-assoc.xml | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969355629@lists.php.net to get a copy of this message | ||
philip Sat Aug 9 16:28:18 2003 EDT
Modified files:
/phpdoc/en/reference/pgsql/functions pg-fetch-assoc.xml
Log:
upgraded example.
Index: phpdoc/en/reference/pgsql/functions/pg-fetch-assoc.xml
diff -u phpdoc/en/reference/pgsql/functions/pg-fetch-assoc.xml:1.5
phpdoc/en/reference/pgsql/functions/pg-fetch-assoc.xml:1.6
--- phpdoc/en/reference/pgsql/functions/pg-fetch-assoc.xml:1.5 Wed Jul 16 05:20:01 2003
+++ phpdoc/en/reference/pgsql/functions/pg-fetch-assoc.xml Sat Aug 9 16:28:18 2003
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.5 $ -->
+<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.2 -->
<refentry id="function.pg-fetch-assoc">
<refnamediv>
@@ -40,20 +40,23 @@
<programlisting role="php">
<![CDATA[
<?php
-$conn = pg_pconnect("dbname=publisher");
+$conn = pg_connect("dbname=publisher");
if (!$conn) {
echo "An error occured.\n";
exit;
}
-$result = pg_query($conn, "SELECT * FROM authors");
+$result = pg_query($conn, "SELECT id, author, email FROM authors");
if (!$result) {
echo "An error occured.\n";
exit;
}
-$arr = pg_fetch_assoc($result, 1);
-echo $arr["author"] . " <- array\n";
+while ($row = pg_fetch_assoc($result)) {
+ echo $row['id'];
+ echo $row['author'];
+ echo $row['email'];
+}
?>
]]>
</programlisting>