Re: PHP postgres connections

From: Yasir Malik <ymalik(at)cs(dot)stevens(dot)edu>
To: Mauro Bertoli <bertolima(at)yahoo(dot)it>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: PHP postgres connections
Date: 2005-04-30 03:47:48
Message-ID: Pine.NEB.4.62.0504292345270.22644@pink-elephant.cs.stevens-tech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> Hi,
> I need to connect to 2 differents Postgres 8.0.0
> databases located in the same machine using the same
> PHP script with an "db wrapper object" instance
> (pg_Connect)... simply a PHP page with contemporarily
> 2 database connections...
>
I don't think this is the right place to ask this, but there's an example
on php.net for using the pg_connect():
<?php
$dbconn = pg_connect("dbname=mary");
//connect to a database named "mary"

$dbconn2 = pg_connect("host=localhost port=5432 dbname=mary");
// connect to a database named "mary" on "localhost" at port "5432"

$dbconn3 = pg_connect("host=sheep port=5432 dbname=mary user=lamb
password=foo");
//connect to a database named "mary" on the host "sheep" with a username
and password

$conn_string = "host=sheep port=5432 dbname=test user=lamb password=bar";
$dbconn4 = pg_connect($conn_string);
//connect to a database named "test" on the host "sheep" with a username
and password
?>

I don't know if that answers your question.

> Can I use however persistent connections ?
>
pg_pconnect() works the same way.

Regards,
Yasir

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2005-04-30 03:48:11 Re: multi-column unique constraints with nullable columns
Previous Message Mauro Bertoli 2005-04-29 16:31:34 PHP postgres connections