RE: [PHP] Oracle and PHP

From: Date: Tue, 26 Jun 2001 20:37:13 +0000
Subject: RE: [PHP] Oracle and PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-55285@lists.php.net to get a copy of this message
That code will work for the Oracle 8.0 but for Oracle 8i you'll want to use the OCI funcitons http://www.php.net/manual/en/ref.oci8.php Using OCI is a little easier to understand then the ORA function (IMO). You'll need to compile PHP with the --with-oci8 switch, and you'll need the Oracle client libs installed. - James > -----Original Message----- > From: Dunaway, Brian [mailto:Brian.Dunaway@schwab.com] > Sent: June 26, 2001 7:25 AM > To: 'php-general@lists.php.net' > Subject: RE: [PHP] Oracle and PHP > > > >I'm a newbie in PHP, what should I do to connect to Oracle Database. > >Do I have to install a library to do that? > >Please anyone, help. > > http://www.phpbuilder.com/manual/ref.oracle.php > > I usually do something similiar to this. > > (psuedo code follows): > > // Define Oracle_Home and Oracle_Sid > putenv("ORACLE_HOME=/opt/ORACLE/product"); > putenv("ORACLE_SID=MYDATA"); > > > // Connect To Oracle Server/Else Return Error(s) > if($connection = ora_logon(my-login,my-pass)) > { > // Open Cursor > $cursor = ora_open($connection); > > $query = "SELECT * FROM table "; > $query .= "ORDER BY date1"; > > // Parse Cursor > ora_parse($cursor, $query); > > if ( ora_exec($cursor) ) > { > $data = array(); > $field = array(); > while(ora_fetch_into($cursor, &$field)) > { > reset ($field); > $data[ $field[0] ] = $field[1]; > } > } > else > { > print("** While Attempting To Open Cursor On Query > ** <br><br>\n\n"); > print("Oracle Returned The Following Error: > <br>\n"); > print(ora_error($cursor)); > print("<br><br>\n\n"); > print("Oracle Error Code: "); > print(ora_errorcode($cursor)); > } > > // Close Cursor > Ora_Close($cursor); > > } > else > { > print("** While Attempting To Open Connection ** <br><br>\n\n"); > print("Oracle Returned The Following Error: <br>\n"); > print(ora_error($connection)); > print("<br><br>\n\n"); > print("Oracle Error Code: "); > print(ora_errorcode($connection)); > } > > // Disconnect > Ora_Logoff($connection); > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#55285) next »