note 44398 added to function.ocibindbyname
| From: | david dot gaia dot kano at dartmouth dot edu | Date: | Wed, 04 Aug 2004 18:24:31 +0000 |
| Subject: | note 44398 added to function.ocibindbyname | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-73943@lists.php.net to get a copy of this message | ||
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.
----
Manual Page -- http://www.php.net/manual/en/function.ocibindbyname.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+44398
Delete -- http://master.php.net/manage/user-notes.php?action=delete+44398&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+44398&report=yes
Search -- http://master.php.net/manage/user-notes.php