note 25321 added to function.ociexecute

From: Date: Thu, 19 Sep 2002 15:18:26 +0000
Subject: note 25321 added to function.ociexecute
Groups: php.notes 
Request: Send a blank email to php-notes+get-36960@lists.php.net to get a copy of this message
Addition to the posting of cthrall@rocketmail.com (from 06-Sep-2000): It's true, you can't call OCIBindByName in a loop and bind to an associative array like this: foreach ($array as $key => $val) { OCIBindByName($state, $key, $val, -1); } BUT: You can do it this way: foreach ($array as $key => $val) { OCIBindByName($state, $key, $array[$key], -1); } Background: the command OCIBindByName BINDS a PHP variable to a parameter, not just its current value. Thus, it is up to you to make sure that the variable has the correct value at the very time when OCIExecute is called, not just when OCIBindByName was called! The PHP variable gets evaluated at the point of OCIExecute and not earlier. This is somewhat more legible than cthrall's solution (but it surely works, too). -- http://www.php.net/manual/en/function.ociexecute.php http://master.php.net/manage/user-notes.php?action=edit+25321 http://master.php.net/manage/user-notes.php?action=delete+25321 http://master.php.net/manage/user-notes.php?action=reject+25321

« previous php.notes (#36960) next »