<HTML ><HEAD ><TITLE >ingres_connect</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Manual de PHP" HREF="index.html"><LINK REL="UP" TITLE="Ingres II functions" HREF="ref.ingres.html"><LINK REL="PREVIOUS" TITLE="ingres_commit" HREF="function.ingres-commit.html"><LINK REL="NEXT" TITLE="ingres_fetch_array" HREF="function.ingres-fetch-array.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Manual de PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.ingres-commit.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.ingres-fetch-array.html" ACCESSKEY="N" >Siguiente</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.ingres-connect" ></A >ingres_connect</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN32114" ></A ><P > (PHP 4 >= 4.0.2)</P >ingres_connect -- Open a connection to an Ingres II database.</DIV ><DIV CLASS="refsect1" ><A NAME="AEN32117" ></A ><H2 >Description</H2 >resource <B CLASS="methodname" >ingres_connect</B > ( [string database [, string username [, string password]]])<BR ></BR ><P > Returns a Ingres II link resource on success, or <TT CLASS="constant" ><B >FALSE</B ></TT > on failure. </P ><P > <B CLASS="function" >ingres_connect()</B > opens a connection with the Ingres database designated by <TT CLASS="parameter" ><I >database</I ></TT >, which follows the syntax <TT CLASS="parameter" ><I >[node_id::]dbname[/svr_class]</I ></TT >. </P ><P > If some parameters are missing, <B CLASS="function" >ingres_connect()</B > uses the values in <TT CLASS="filename" >php.ini</TT > for <TT CLASS="parameter" ><I >ingres.default_database</I ></TT >, <TT CLASS="parameter" ><I >ingres.default_user</I ></TT > and <TT CLASS="parameter" ><I >ingres.default_password</I ></TT >. </P ><P > The connection is closed when the script ends or when <A HREF="function.ingres-close.html" ><B CLASS="function" >ingres_close()</B ></A > is called on this link. </P ><P > All the other ingres functions use the last opened link as a default, so you need to store the returned value only if you use more than one link at a time. </P ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN32146" ></A ><P ><B >Ejemplo 1. <B CLASS="function" >ingres_connect()</B > example</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="programlisting" ><?php $link = ingres_connect ("mydb", "user", "pass") or die ("Could not connect"); print ("Connected successfully"); ingres_close ($link); ?></PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN32150" ></A ><P ><B >Ejemplo 2. <B CLASS="function" >ingres_connect()</B > example using default link</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="programlisting" ><?php ingres_connect ("mydb", "user", "pass") or die ("Could not connect"); print ("Connected successfully"); ingres_close (); ?></PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE ><P > See also <A HREF="function.ingres-pconnect.html" ><B CLASS="function" >ingres_pconnect()</B ></A >, and <A HREF="function.ingres-close.html" ><B CLASS="function" >ingres_close()</B ></A >. </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.ingres-commit.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Inicio</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.ingres-fetch-array.html" ACCESSKEY="N" >Siguiente</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >ingres_commit</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.ingres.html" ACCESSKEY="U" >Subir</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >ingres_fetch_array</TD ></TR ></TABLE ></DIV ></BODY ></HTML >