note 106067 added to function.oci-collection-element-get
| From: | krajcar dot peter at gmail dot com | Date: | Fri, 07 Oct 2011 09:11:31 +0000 |
| Subject: | note 106067 added to function.oci-collection-element-get | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-183699@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 147.32.160.17
Probable Submitter: 90.183.137.131
----
Manual Page -- http://www.php.net/manual/en/function.oci-collection-element-get.php
Edit -- https://master.php.net/note/edit/106067
Del: integrated -- https://master.php.net/note/delete/106067/integrated
Del: useless -- https://master.php.net/note/delete/106067/useless
Del: bad code -- https://master.php.net/note/delete/106067/bad+code
Del: spam -- https://master.php.net/note/delete/106067/spam
Del: non-english -- https://master.php.net/note/delete/106067/non-english
Del: in docs -- https://master.php.net/note/delete/106067/in+docs
Del: other reasons-- https://master.php.net/note/delete/106067
Reject -- https://master.php.net/note/reject/106067
Search -- https://master.php.net/manage/user-notes.php