#50574 [Opn->Csd]: PDO prepared statement failed with UPDATE and WHERE conditions
| From: | ajulien at gmail dot com | Date: | Fri, 25 Dec 2009 16:41:05 +0000 |
| Subject: | #50574 [Opn->Csd]: PDO prepared statement failed with UPDATE and WHERE conditions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-146109@lists.php.net to get a copy of this message | ||
ID: 50574
User updated by: ajulien at gmail dot com
Reported By: ajulien at gmail dot com
-Status: Open
+Status: Closed
Bug Type: PDO related
Operating System: OSX 10.6
PHP Version: 5.2.12
New Comment:
Sounds like the bug is else where because this works :
<?php
$db = new PDO('sqlite:foo.sqlite');
$db->query("DROP TABLE users");
$db->query("CREATE TABLE users (user MEDIUMTEXT ( 255 ), level INTEGER
( 2 ))");
$db->query("INSERT INTO users VALUES('foobar',2)");
$db->query("INSERT INTO users VALUES('John Doe',2)");
$db->query("INSERT INTO users VALUES('John Doe',2)");
$prep = $db->prepare('UPDATE "users" SET "level" = ? WHERE
"user"= ?
');
var_dump($prep);
$prep->execute(array('99','foobar'));
var_dump($db->errorInfo());
?>
Previous Comments:
------------------------------------------------------------------------
[2009-12-25 16:21:51] ajulien at gmail dot com
Description:
------------
A simple prepared statement will fail with « bind or column index out
of
range » in some cases
Reproduce code:
---------------
$prep = $db->prepare('UPDATE "users" SET "force" = ? WHERE (
"user" = ?
)');
$prep->execute(array('bar','foo'));
Expected result:
----------------
The update should be executed
Actual result:
--------------
« bind or column index out of range »
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50574&edit=1