note 62112 deleted from function.oci-bind-by-name by sixd
| From: | sixd@php.net | Date: | Sat, 14 Nov 2009 00:36:19 +0000 |
| Subject: | note 62112 deleted from function.oci-bind-by-name by sixd | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-162891@lists.php.net to get a copy of this message | ||
Note Submitter: js at mcs dot be
----
Be careful that the variable argument is a reference. So, the following code does not work:
foreach($some_array as $key => $value)
{
OCIBindByName($stmt, $key, $value);
}
I assume this is because the contents of $value changes, even though the reference remains the same,
so all bound variables end up pointing to the last loop iteration's value.
Instead use the following:
foreach($some_array as $key => $value)
{
OCIBindByName($stmt, $key, $some_array[$key]);
}