Developer Forums | About Us | Site Map


Web Host
site hosted by netplex

Online Manuals


(PHP 3>= 3.0.4, PHP 4 )

ocifetchinto -- Fetches the next row into an array


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

$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().

Copyright 2004-2024 All rights reserved. Site hosted by NETPLEX