note 55197 added to function.pdostatement-execute
| From: | wb at pro-net dot co dot uk | Date: | Wed, 27 Jul 2005 13:27:03 +0000 |
| Subject: | note 55197 added to function.pdostatement-execute | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-92554@lists.php.net to get a copy of this message | ||
When binding parameters you are not allowed to use them more then once in your query, therefore the
following is invalid...
<?php
$statement = $pdo->prepare("SELECT * FROM table WHERE a > :value AND b <
:value");
$statement->execute(array(':value' => 6));
?>
You should, instead, create a number of parameters and bind them separately...
<?php
$statement = $pdo->prepare("SELECT * FROM table WHERE a > :valueA AND b <
:valueB");
$statement->execute(array(':valueA' => 6, 'valueB' => 6));
?>
----
Manual Page -- http://www.php.net/manual/en/function.pdostatement-execute.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+55197
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55197&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55197&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55197&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55197&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55197&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55197&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+55197&report=yes
Search -- http://master.php.net/manage/user-notes.php