Subject Re: [firebird-php] ibase_execute arguments, HELP
Author Lester Caine
Erik Raul Chan Silveira wrote:

> Hello People, Good Morning (afternoon or night):
>
> Im trying to do a script for importing text data to any table in a FB
> DB.
>
> I create the INSERT statement by reading table name & fields names,
> something
> like:
>
> ....
> $statement = 'INSERT INTO TableA (Field1, Field2, Field3) VALUES
> (?, ?, ?)';
> (this is the easy part), then:
>
> ....
> $stmt = $statement;
> $trans =ibase_trans();
> $prep = ibase_prepare($stmt) or die("Incorrect stmt ...");
>
> while(!feof($file)) {
> $line = trim(fgets($file, 1024));
> $arrValues = array();
>
> /*process to obtain the values from the line....*/
> $arrValues['Value'][] = 'XXX ';
> ...
> $arrValues['Value'][] = '100.00';
> .....
> $arrValues['Value'][] = 'ZZZZ';
You have 'One' array entry with three sub entries.
Just drop the ['Value'] so that you end up with three array entries.

> /*at the end of this process i have a array with the values for
> the fields*/
>
> $obj = ibase_execute($prep, $arrValues['Value']) or $error = 1;
> if($error == 1){
> echo "\n" .print_r($arrValores);
> }
>
> } //while
> fclose($file);
> ibase_commit($trans);
> ibase_free_query($prep);
>
> The error Im obtaining is "function.ibase-execute: statement expects
> 3 arguments, 1 given in ..."
> (Of course the number 3 is depending on the table in process.)
>
> Is there a way to doit with arrays or how can I accomplish it ?
>
> Please, help me. Im very new to PHP.


--
Lester Caine
-----------------------------
L.S.Caine Electronic Services