On Wed, Dec 28, 2005 at 02:14:43PM +0100, Markus Fischer wrote: > 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')); > ... Just out of curiosity, how does this perform: $p->exec('INSERT ... VALUES('test1', 'test2')); > ... > 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. yeah a crash is bad. I'm not familiar with windows installs so I dont really know if it is a bad install or related to php's pdo_odbc driver. > > Am I doing something conceptual wrong? The code looks like it should perform as you have it. Although if this is just for one insert statment i would use the $dbh->exec() method instead. The prepare/execute method is more for batching a bunch of queries: $stmt = $dbh->prepare('insert into foo(value) values(?)'); for($i=0; $i < 10; $i++) { $stmt->execute(array($i)); } But then again it should be working either way. Curt. -- cat .signature: No such file or directory -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php