Re: php + postgresql - Mailing list pgsql-general

From Aarni Ruuhimäki
Subject Re: php + postgresql
Date
Msg-id 200807241514.13444.aarni@kymi.com
Whole thread Raw
In response to php + postgresql  (admin <mick@mjhall.org>)
Responses Re: php + postgresql
List pgsql-general
On Thursday 24 July 2008 12:41, admin wrote:
> 1.
> I ended up using pg_prepare() and pg_execute() as pg_query() alone just
> didn't seem to work. But SELECT statements seemed to be cached or
> persistent in some way, such that they "lived" beyond the life of the
> PHP script. Is there something I need to know about persistent behaviour
> in PG that doesn't exist in MySQL?

Not sure what causes this with your server but I always use something like
this, ie first connect then do your stuff and then close the connection:

require("dbconnect.inc"); // holds the $conn which is pg_connect("with
passes")

if (!$conn)
  {exit("Database connection failed. Please try again." . $conn);}

$sql ="SELECT ...";

$product=pg_exec($conn,$sql);
if (!$product)
  {exit("Database connection failed. Please try again.");}

while ($row = pg_fetch_row($product))
{
echo"

$row[1]

";
}

pg_close($conn);

BR,
--
Aarni

Burglars usually come in through your windows.

pgsql-general by date:

Previous
From: "John D. Burger"
Date:
Subject: FK check will use index on referring table?
Next
From: Stephen Frost
Date:
Subject: Re: FK check will use index on referring table?