ocifetchinto

(PHP 3>= 3.0.4, PHP 4 )

ocifetchinto -- Fetches the next row into an array

Description

int ocifetchinto ( resource stmt, array &result [, int mode])

ocifetchinto() fetches the next row (for SELECT statements) into the result array. ocifetchinto() will overwrite the previous content of result. By default result will contain a zero-based array of all columns that are not NULL.

The mode parameter allows you to change the default behaviour. You can specify more than one flag by simply adding them up (eg OCI_ASSOC+OCI_RETURN_NULLS). The known flags are:

OCI_ASSOC Return an associative array.
OCI_NUM Return an numbered array starting with zero. (DEFAULT)
OCI_RETURN_NULLS Return empty columns.
OCI_RETURN_LOBS Return the value of a LOB instead of the descriptor.

Example 1. A simple ocifetchinto() example

<?php
$conn = ocilogon("username","password");

$query = "SELECT apples FROM oranges";

$statement = OCIParse ($conn, $query);
OCIExecute ($statement);

while (OCIFetchInto ($statement, $row, OCI_ASSOC)) {
    print $row['apples'];
}
?>

See also ocifetch() and ociexecute().