note 106067 deleted from function.oci-collection-element-get by danbrown
| From: | danbrown@php.net | Date: | Fri, 07 Oct 2011 14:53:46 +0000 |
| Subject: | note 106067 deleted from function.oci-collection-element-get by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-183714@lists.php.net to get a copy of this message | ||
Note Submitter: krajcar dot peter at gmail dot com
----
As Anonymous here pointed out, this doc to getElem() function is incorrect. The first index is
definately 0 (zero).
Anyway, an example from "The Underground Oracle and PHP Manual":
<?php
$c = oci_connect("hr", "hrpwd", "localhost/XE");
$s = oci_parse($c, 'begin MyProc(:res_id, :res_data); end;');
$res_id = oci_new_collection($c, 'MYIDREC');
$res_data = oci_new_collection($c, 'MYDATAREC');
oci_bind_by_name($s, ':res_id', $res_id, -1, OCI_B_NTY);
oci_bind_by_name($s, ':res_data', $res_data, -1, OCI_B_NTY);
oci_execute($s);
for ($i = 0; $i < $res_id->size(); $i++) {
$id = $res_id->getElem($i);
$data = $res_data->getElem($i);
echo "Id: $id, Data: $data<br>\n";
}
?>
Notice that $i = 0; in for loop.