<HTML ><HEAD ><TITLE >pg_Connect</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.44"><LINK REL="HOME" TITLE="PHP Manual" HREF="manual.html"><LINK REL="UP" TITLE="PostgreSQL functions" HREF="ref.pgsql.html"><LINK REL="PREVIOUS" TITLE="pg_cmdTuples" HREF="function.pg-cmdtuples.html"><LINK REL="NEXT" TITLE="pg_DBname" HREF="function.pg-dbname.html"></HEAD ><BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.pg-cmdtuples.html" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.pg-dbname.html" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.pg-connect" >pg_Connect</A ></H1 ><DIV CLASS="refnamediv" ><A NAME="AEN23900" ></A >pg_Connect -- opens a connection</DIV ><DIV CLASS="refsect1" ><A NAME="AEN23903" ></A ><H2 >Description</H2 ><DIV CLASS="funcsynopsis" ><P ></P ><CODE CLASS="FUNCDEF" >int pg_connect</CODE >(string host, string port, string options, string tty, string dbname);<P ></P ></DIV ><P > Returns a connection index on success, or false if the connection could not be made. Opens a connection to a PostgreSQL database. Each of the arguments should be a quoted string, including the port number. The options and tty arguments are optional and can be left out. This function returns a connection index that is needed by other PostgreSQL functions. You can have multiple connections open at once. </P ><P > A connection can also established with the following command: <B CLASS="command" >$conn = pg_connect("dbname=marliese port=5432");</B > Other parameters besides <TT CLASS="parameter" ><I >dbname</I ></TT > and <TT CLASS="parameter" ><I >port</I ></TT > are <TT CLASS="parameter" ><I >host</I ></TT >, <TT CLASS="parameter" ><I >tty</I ></TT >, <TT CLASS="parameter" ><I >options</I ></TT >, <TT CLASS="parameter" ><I >user</I ></TT > and <TT CLASS="parameter" ><I >password</I ></TT >. </P ><P > See also <B CLASS="function" >pg_pConnect()</B >. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.pg-cmdtuples.html" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="manual.html" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.pg-dbname.html" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >pg_cmdTuples</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.pgsql.html" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >pg_DBname</TD ></TR ></TABLE ></DIV ></BODY ></HTML >