PDO & pdo_odbc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I'm using the following code in a PHP 5.1, Windows CLI environment:

$p = new PDO('odbc:driver={Microsoft Access Driver (*.mdb)};Dbq=beispieldatenbank.mdb');
$s = $p->prepare('INSERT INTO ADDRESSES(TITLE0, LASTNAME0) VALUES(?, ?)');
$s->execute(array('test1', 'test2'));

I'm always getting the last value of the array passed to execute in all the fields which have markers in the prepare statement, like I would have written:

INSERT INTO ADDRESSES(TITLE0, LASTNAME0) VALUES('test2', 'test2')

I also tried bindValue like this

$s = $p->prepare('INSERT INTO ADDRESSES(TITLE0, LASTNAME0) VALUES(?, ?)');
$s->bindValue(1, 'test1');
$s->bindValue(2, 'test2');
$s->execute();

or name values:

$s = $p->prepare('INSERT INTO ADDRESSES(TITLE0, LASTNAME0) VALUES(:a, :b)');
$s->bindValue(':a', 'test1');
$s->bindValue(':b', 'test2');
$s->execute();

but which all resulted in a row being inserted but the values were just empty.

When I tried something like this:
$s = $p->prepare('INSERT INTO ADDRESSES(TITLE0, LASTNAME0) VALUES(?, ?)');
$val1 = 'test1';
$val2 = 'test2';
$s->bindParam(1, $val1);
$s->bindParam(2, $val2);
$s->execute();

I even get a crash.

Am I doing something conceptual wrong?

thanks for any pointers,
- Markus

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux