upgraded example.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@137174 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Philip Olson 2003-08-09 20:28:18 +00:00
parent 368a4c6ec5
commit 24f0df4967

View file

@ -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>