Re: [SQL] PostgreSQL and PHP

From: Stefano Brozzi <sbrozzi(at)bci(dot)it>
To: James Macken <jmac(at)nemesis(dot)com(dot)au>
Cc: pgsql-sql(at)hub(dot)org
Subject: Re: [SQL] PostgreSQL and PHP
Date: 2000-02-24 11:37:19
Message-ID: 38B517EF.B4090EA0@bci.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Giampiero Raschetti 2000-02-24 12:00:33 Re: [SQL] PostgreSQL and PHP
Previous Message James Macken 2000-02-24 11:06:01 PostgreSQL and PHP