Re: Re: ORA-01460 error when useing bind sql on oracle from php
| From: | Christopher Jones | Date: | Mon, 15 Dec 2003 07:43:25 +0000 |
| Subject: | Re: Re: ORA-01460 error when useing bind sql on oracle from php | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-32037@lists.php.net to get a copy of this message | ||
Using "OCIBindByName($stmt,$bindname,&${"bindval$ci"},-1);" probably gives
a warning that call-time pass-by-reference has been deprecated.
The OCIBindByName manual entry at http://www.php.net/manual/en/function.ocibindbyname.php
has a user comment from "alexander dot zimmer at gmx dot at" that this doesn't work:
foreach ($array as $key => $val)
{
OCIBindByName($state, $key, $val, -1);} but that this does: foreach ($array as $key => $val) {
OCIBindByName($state, $key, $array[$key], -1);} See the entry in the manual page for the explanation. Chris Are Pedersen wrote:
Problem solved! As OCIBindByName is binding to the actual variable, that variable must not be changed. I modified my script to look like this: ---***--- $ci=0; foreach ($bindargs as $bindname => $bindvalue){ ${"bindval$ci"}=$bindvalue; OCIBindByName($stmt,$bindname,&${"bindval$ci"},-1); $ci++; } ---***--- Are Pedersen wrote:I get "ORA-01460: unimplemented or unreasonable conversion requested" when useing bind-sql on Oracle 9i. I am useing OCI 8.1 client in PHP. What is wrong? And what does this message mean? Here is the code: ---***--- $bindarray1=array(':project1'=>$project); $bindarray1[':userid']=$userid; $rs = sql_query($qs,$bindarray1); function sql_query($qs,$bindargs) { $stmt = @OCIParse($this->db_sqlhandler, $qs); if (!$stmt) {return false;} //bind all the variables if (is_array($bindargs)){foreach ($bindargs as $bindname => $bindvalue){ OCIBindByName($stmt,$bindname,&$bindvalue,-1); }} if (@OCIExecute($stmt)) {return $stmt;} $DB_ERROR = OCIError($stmt); return $DB_ERROR; } ---***---