From: Stefano Brozzi <sbrozzi@bci.it>
To: James Macken <jmac@nemesis.com.au>
Cc: pgsql-sql@hub.org
Subject: Re: [SQL] PostgreSQL and PHP
Date: Thu, 24 Feb 2000 12:37:19 +0100
Message-ID: <38B517EF.B4090EA0@bci.it> (raw)
References: <001701bf7eb7$23a82400$ac7d2bcb@jay>
James Macken wrote:
>
> To those of you who use PHP with PostgreSQL,
>
> I'm trying to do a simple select inside a ".php3" script. The php3 script
> simply says something like (the linux machine is not turned on so I can't
> grab it exactly):
>
> <?php
> $database = pg_connect("","","","mydb");
> pg_exec($database, "select * from mytable");
> echo "whatever"
> ?>
>
> and all I get is (in the resulting web page):
>
> whatever
>
I guess you have more lines in your php script,
have you lines like these:
$result = pg_Exec ($database, $sqlStr);
if (!$result) {
echo "An error occured.\n";
exit;
}
for($i=0; $i<pg_NumRows($result); $i++)
{
$row = pg_Fetch_array($result, $i);
echo $row[1];
}
???
if not, please RTFM.
if you have written down these lines (or cut&pasted from the manual),
and still it doesn't work, feel free to contact me.
stefano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: sbrozzi@bci.it, jmac@nemesis.com.au, pgsql-sql@hub.org
Subject: Re: [SQL] PostgreSQL and PHP
In-Reply-To: <38B517EF.B4090EA0@bci.it>
References: <001701bf7eb7$23a82400$ac7d2bcb@jay> <38B517EF.B4090EA0@bci.it>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox