note 44398 deleted from function.ocibindbyname by sixd
| From: | sixd@php.net | Date: | Wed, 20 Nov 2013 19:48:51 +0000 |
| Subject: | note 44398 deleted from function.ocibindbyname by sixd | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197593@lists.php.net to get a copy of this message | ||
Note Submitter: david dot gaia dot kano at dartmouth dot edu
----
Here is a new twist I just discovered (at least with PHP 4.3.5). While it is true that doing
something like this works:
----------
$dataArray = array("name" => "david", "sport" => "rock
climbing");
$lengths = array("name" => 25, "sport" => 100);
// imagine the ociparse here
foreach($dataArray as $col => $val) {
ocibindbyname($statement, $col, $dataArray[$val], $lengths[$col])
}
ociexecute($statement);
$dataArray["name"] = "jane";
$dataArray["sport"] = "kayaking";
ociexecute($statement);
---------
The following ADDITIONAL lines of code would not:
--------
function getDataArray() {
$ret["name"] = "susan";
$ret["sport"] = "walking";
return($ret);
}
$dataArray = getDataArray();
ociexecute($statement);
--------
As far as I can tell, the last execute would attempt to insert using the same data as the second
execute. In other words when reassigning the whole associative array rather than just each member in
the array, the binds do not work as expected. I think this is also a problem when the array has
never been assigned to anything yet, when you do the binds.