binding Oracle variables on a loop
- From: Peter <gzmbk1@xxxxxxx>
- Date: Mon, 27 Nov 2006 11:20:23 -0500
Hello all
I'm having trouble binding variables using oci_bind_by_name with the correct values
I have an array with the following elements
$bindVar['recNum'] = "1";
$bindVar['tblName'] = "table1";
$bindVar['loginName'] = "Mark";
$bindVar['descrip'] = "Test";
$sqlString = "insert into log_tbl " .
"(record, tablename, cdate, login, descrip) " .
"(:recNum, :tblName, sysdate, :loginName, :descrip)";
then I pass that in as an parameter to a method
$this->executeOracleStatement("DB",$sqlString,$bindVar);
on the executeOracleStatement method I do the following:
1. oci_connect
2. oci_parse
3. and when it comes time to the oci_bind_by_name I have the following code:
foreach ($bindVariables as $idx => $value) {
$bindOk = oci_bind_by_name($statementID, ":$idx",$value);
if (! $bindOk){
$this->dumpOracleError("SQLERR-000006 - ERROR - SQL BIND FAILED", $bindOk);
}
}
it doesn't return an error
4. oci_execute. (doesn't return errors either)
but the problems is that when I check the inserted record
let say that the last value of the array was for example $bindVar['descrip'] = "TEST"
all the inserted fields retain the last value of the array which is TEST, instead of inserting the values 1, table1, Mark, TEST
it's all TEST, TEST, TEST, TEST
can somebody help?
thanks
Peter
.
- Prev by Date: Re: [PHP] Storing objects in sessions recursively
- Next by Date: Re: [PHP] Running AMP from CD
- Previous by thread: Running AMP from CD
- Next by thread: Invalid hex returned from dechex();
- Index(es):
Relevant Pages
|