(PHP 4, PHP 5, PHP 7)
pg_connect — ��һ�� PostgreSQL ����
$connection_string
) : resourcepg_connect() �������� PostgreSQL ��������Ҫ����Դ��
pg_connect() ��һ����
connection_string
��ָ����
PostgreSQL ���ݿ�����ӡ�����ɹ���������Դ���������������
FALSE
��connection_string
Ӧ�������������������ַ�����
Example #1 ʹ�� 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
?>
connection_string
�������IJ�����
host
��port
��tty
, options
��dbname
, user
�� password
��
�����ͬ���� connection_string
�ٴε���
pg_connect()�����Ὠ�������ӣ����Ƿ���ǰ���Ѿ���������Դ�����ʹ�ò�ͬ�������ַ���������Ժ�ͬһ�����ݿ⽨��������ӡ�
�ɵĶ����� $conn = pg_connect("host", "port", "options", "tty", "dbname") �Ѿ����ᳫʹ�á�
�μ� pg_pconnect()��pg_close()��pg_host()��pg_port(), pg_tty()��pg_options() �� pg_dbname()��