integer ora_do(integer connection, string query)
The ora_do function executes a query on the given connection. PHP takes care of
creating a cursor, parsing the query, and executing it. A cursor identifier is returned.
<?
//in case these aren't set for httpd
putenv("ORACLE_HOME=/usr/local/oracle7");
putenv("ORACLE_SID=ORCL");
// connect to server
if($Connection = ora_logon("scott", "tiger"))
{
$Query = "SELECT ENAME ";
$Query .= "FROM emp ";
$Query .= "WHERE ENAME LIKE 'SMI%' ";
if($Cursor = ora_do($Connection, $Query))
{
ora_fetch($Cursor);
print(ora_columnname($Cursor, 0). "
\n");
// Close the Oracle cursor
ora_close($Cursor);
}
// disconnect.
ora_logoff($Connection);
}
?>
string ora_error(integer identifier)
The ora_error function returns a string that describes the error for the last command
sent to the Oracle database. The identifier may be either a connection identifier or a
cursor identifier.
The message takes the form of XXX-NNNNN, where XXX tells you where the error came
from and NNNNN tells you the error number. If you want to look up a description of the
error, you can use Oracle's oerr command. See ora_exec for an example of use.
integer ora_errorcode(integer identifier)
The ora_errorcode function returns the error number for the last command sent to the
Oracle server. The identifier may be either a connection identifier or a cursor identifier.
See ora_exec for an example of use.