note 69291 added to function.pdo-prepare
| From: | roth at egotec dot com | Date: | Wed, 30 Aug 2006 08:58:13 +0000 |
| Subject: | note 69291 added to function.pdo-prepare | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-116503@lists.php.net to get a copy of this message | ||
Attention using MySQL and prepared statements.
Using a placeholder multiple times inside a statement doesn't work. PDO just translates the
first occurance und leaves the second one as is.
select id,name from demo_de where name LIKE :name OR name=:name
You have to use
select id,name from demo_de where name LIKE :name OR name=:name2
and bind name two times. I don't know if other databases (for example Oracle or MSSQL) support
multiple occurances. If that's the fact, then the PDO behaviour for MySQL should be changed.
----
Server IP: 66.163.161.117
Probable Submitter: 84.173.146.220
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.pdo-prepare.php
Edit -- https://master.php.net/note/edit/69291
Del: integrated -- https://master.php.net/note/delete/69291/integrated
Del: useless -- https://master.php.net/note/delete/69291/useless
Del: bad code -- https://master.php.net/note/delete/69291/bad+code
Del: spam -- https://master.php.net/note/delete/69291/spam
Del: non-english -- https://master.php.net/note/delete/69291/non-english
Del: in docs -- https://master.php.net/note/delete/69291/in+docs
Del: other reasons-- https://master.php.net/note/delete/69291
Reject -- https://master.php.net/note/reject/69291
Search -- https://master.php.net/manage/user-notes.php