Search Postgresql Archives

Re: php + postgresql

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux