Hi all, sorry for the maybe offtopic questions, but I did not get any answer
from the PHP ML.
I would like to query a postgresql db with the php language.
Today I wrote a script (connectandquery.php) performing the following :
- connect to the DB : $conn = pg_Connect("dbname = foo");
- execute the query : $res = pg_Exec($conn,"SELECT * from BAR");
But I would like to write this in two scripts :
- connect.php : $conn = pg_Connect("dbname = foo");
- query.php : $res = pg_Exec($conn,"SELECT * from BAR");
but I don't know how to get the $conn variable (defined in connect.php) in
the script query.php.
Any idea is welcome !