Re: maybe Offtopic : PostgreSQL & PHP ?
От | Keith Wong |
---|---|
Тема | Re: maybe Offtopic : PostgreSQL & PHP ? |
Дата | |
Msg-id | 5.0.2.1.0.20010418223233.00a68170@mail.e-magine.com.au обсуждение исходный текст |
Ответ на | maybe Offtopic : PostgreSQL & PHP ? ("Picard, Cyril" <cyril.picard@eads-dsn.com>) |
Ответы |
Re: maybe Offtopic : PostgreSQL & PHP ?
|
Список | pgsql-sql |
Not quite sure how your code is organised... but you could access the variable $conn by including "connect.php" into the "query.php" script. Otherwise, you will need to use persistent connections... which can be achieved via pg_pconnect... a persistent connection will instead of creating a new database connection each time.. it will try to use an existing connection that is no longer being used (persistent connections do tend to have a lot of quirks tho) Keith At 11:33 AM 18/04/2001 +0200, Picard, Cyril wrote: >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 ! > >---------------------------(end of broadcast)--------------------------- >TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
В списке pgsql-sql по дате отправления: