note 98715 added to pdostatement.bindparam
| From: | sergiy dot sokolenko at gmail dot com | Date: | Fri, 02 Jul 2010 10:22:31 +0000 |
| Subject: | note 98715 added to pdostatement.bindparam | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-170649@lists.php.net to get a copy of this message | ||
Note that you cannot mix named and positional parameters in one query:
<?php
$stmt = $conn->prepare('SELECT * FROM employees WHERE name LIKE :name OR email LIKE
?');
$name = 'John%';
$email = 'john%';
$stmt->bindParam(':name', $name);
$stmt->bindParam(1, $email);
$stmt->execute();
?>
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid
parameter number: mixed named and positional parameters' in ...
Running PHP 5.3.2 on Linux x86-64
----
Server IP: 69.147.83.197
Probable Submitter: 92.113.129.205
----
Manual Page -- http://www.php.net/manual/en/pdostatement.bindparam.php
Edit -- https://master.php.net/note/edit/98715
Del: integrated -- https://master.php.net/note/delete/98715/integrated
Del: useless -- https://master.php.net/note/delete/98715/useless
Del: bad code -- https://master.php.net/note/delete/98715/bad+code
Del: spam -- https://master.php.net/note/delete/98715/spam
Del: non-english -- https://master.php.net/note/delete/98715/non-english
Del: in docs -- https://master.php.net/note/delete/98715/in+docs
Del: other reasons-- https://master.php.net/note/delete/98715
Reject -- https://master.php.net/note/reject/98715
Search -- https://master.php.net/manage/user-notes.php