integer ora_fetch_into(integer cursor, reference fields, integer
flags)
The ora_fetch_into function gets the next row from the cursor and puts it into the
fields argument, which must be passed by reference. Fields will contain an array
indexed by numbers, starting with zero. The number of fields fetched is returned. The
optional flags argument is a bit field that uses two constants, ORA_FETCHINTO_ASSOC
and ORA_FETCHINTO_NULLS. The first instructs ora_fetch_into to create array elements
named by their database fields. The second allows causes null columns to be represented
as empty strings.
<?
//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")))
{
print("Could not connect to database!
\n");
exit;
}
$Query = "SELECT EMPNO ";
$Query .= "FROM emp ";
if(!($Cursor = ora_do($Connection, $Query)))
{
print("Cursor could not be opened!
\n");
print("Error Code: ". ora_errorcode($Connection).
"
\n");
print("Error Message: ". ora_error($Connection).
"
\n");
exit;
}
while(ora_fetch_into($Cursor, &$Column))
{
print("$Column[0]
\n");
}
// Close the Oracle cursor
ora_close($Cursor);
// disconnect.
ora_logoff($Connection);
?>
string ora_getcolumn(integer cursor, integer column)