note 117596 rejected from pdo.prepare by cmb
| From: | cmb@php.net | Date: | Fri, 03 Jul 2015 22:00:31 +0000 |
| Subject: | note 117596 rejected from pdo.prepare by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-203042@lists.php.net to get a copy of this message | ||
Note Submitter: skydiel at yahoo dot com dot br
----
I am not sure if this is a bug or a feature, but if you define named parameters like :id, you can
omit the colon on the associative array passed to execute() and the query will work as if the colon
was there.
For example:
$db->prepare('SELECT * FROM users WHERE id=:id);
$db->execute(array('id'=>1)); // work just fine