Re: php + postgresql

From: Aarni Ruuhimäki <aarni(at)kymi(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: admin <mick(at)mjhall(dot)org>
Subject: Re: php + postgresql
Date: 2008-07-24 12:14:13
Message-ID: 200807241514.13444.aarni@kymi.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message admin 2008-07-24 12:33:01 Re: php + postgresql
Previous Message John DeSoi 2008-07-24 11:55:03 Re: mac install question