mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
upgraded example.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@137174 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
368a4c6ec5
commit
24f0df4967
1 changed files with 8 additions and 5 deletions
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue