note 8335 modified in function.ocibindbyname by felipe
| From: | felipe@php.net | Date: | Mon, 21 Jul 2008 01:15:42 +0000 |
| Subject: | note 8335 modified in function.ocibindbyname by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142380@lists.php.net to get a copy of this message | ||
So, if you're calling OCIBindByName in a loop and binding to an associative array like this:
<?php
while (list($key, $val) = each($array)) {
OCIBindByName($state, $key, $val['VALUE'], $val['LENGTH']);
}
?>
it won't work. My WAG is that OCI gets confused when you bind a bunch of values to what
appears to be the same variable, then call OCIExecute.
Workaround is create a new array, and copy values into it:
<?php
$value = array();
$i = 0;
while (list($key, $val) = each($array)) {
$value[$i] = $val['VALUE'];
OCIBindByName($state, $key, $value[$i], $val['LENGTH']);
$i++;
}
?>
--was--
So, if you're calling OCIBindByName in a loop and binding to an associative array like this:
while (list($key, $val) = each($array))
{
OCIBindByName($state, $key, $val['VALUE'], $val['LENGTH']);
}
it won't work. My WAG is that OCI gets confused when you bind a bunch of values to what
appears to be the same variable, then call OCIExecute.
Workaround is create a new array, and copy values into it:
$value = array();
$i = 0;
while (list($key, $val) = each($array))
{
$value[$i] = $val['VALUE'];
OCIBindByName($state, $key, $value[$i], $val['LENGTH']);
$i++;
}
http://php.net/manual/en/function.ocibindbyname.php