|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2005-12-14 21:04 UTC] mknobloch at midstate dot edu
 Description:
------------
When using a named parameters array, PDO_ODBC substitutes the last value in the array for each named parameter.
This code works fine in 5.1.0.  The bug first appeared in 5.1.1.  I can also confirm that this bug does not affect PDO_SQLITE.
Reproduce code:
---------------
$dbh = new PDO("odbc:testdb");
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
$sql = "INSERT INTO testtable (field1, field2, field3) VALUES (:value1, :value2, :value3)";
$sth = $dbh->prepare($sql, array(PDO::ATTR_CURSOR, PDO::CURSOR_FWDONLY));
$parm = array(
   ":value1" => 15,
   ":value2" => 20,
   ":value3" => 25
);
$sth->execute($parm);
Expected result:
----------------
I expect a new record to be inserted into the table with field1 = 15, field2 = 20, and field3 = 25
Actual result:
--------------
A new record is created, but 25 is inserted into all three fields.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 16:00:01 2025 UTC | 
No bug in sqlite2 and sqlite Driver. $oPdo = new PDO('sqlite:test.lite'); $oStat = $oPdo->prepare("INSERT INTO php_qqq (name, value) VALUES (?, ?)"); $oStat->execute(array('1','444')); ____ in table php_qqq have values (1 and 444);