Re: [SQL] PostgreSQL and PHP - Mailing list pgsql-sql

From Stefano Brozzi
Subject Re: [SQL] PostgreSQL and PHP
Date
Msg-id 38B517EF.B4090EA0@bci.it
Whole thread Raw
In response to PostgreSQL and PHP  ("James Macken" <jmac@nemesis.com.au>)
List 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


pgsql-sql by date:

Previous
From: "James Macken"
Date:
Subject: PostgreSQL and PHP
Next
From: Giampiero Raschetti
Date:
Subject: Re: [SQL] PostgreSQL and PHP