binding Oracle variables on a loop



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
.



Relevant Pages

  • Re: Transferring related records from table to table in one transaction: Two cursors? [Mac FMP 9 Adv
    ... I should then begin inserting each row in this virtual two-dimensional ... array into new related rows in Postings. ... After having inserted all rows into the Postings table, I can commit the ... You need to create importing routines that may store total record numbers in fields to confirm the entire transaction has taken place, in case of a crash or interruption during the import, but this also applies to other methodologies. ...
    (comp.databases.filemaker)
  • Re: a rand array
    ... inserting an element into an arbitrary position in an ... > check for equals in array is O ... When an algorithm has a time complexity of O), ... Insertion is O(I think it'll take something like N/4 iterations on ...
    (comp.lang.c)
  • Re: a rand array
    ... check for equals in array is O ... and randand goto label until no equal ... inserting ... >Linear search isn't all that great, but it doesn't matter much in this case. ...
    (comp.lang.c)
  • Re: Anyone can help?
    ... Inserting into arrays requires copying the array elements ... care about pointers to individual instructions getting invalidated ... insertion not to invalidate pointers to individual members, ...
    (comp.lang.c)
  • Re: Array of text boxes on form
    ... I requested help on inserting many ... > handholding through this to create an array of unbound ... a string index to similarly named control using concatenation of an ...
    (microsoft.public.access.formscoding)