note 89810 deleted from pdostatement.bindparam by thiago
| From: | thiago@php.net | Date: | Tue, 24 Mar 2009 11:59:06 +0000 |
| Subject: | note 89810 deleted from pdostatement.bindparam by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-152375@lists.php.net to get a copy of this message | ||
Note Submitter: Janci
----
@Alex: You might want to use something like this instead:
<?php
// $ids = array(1,2,3,4);
if (is_array($ids) && count($ids) > 0)
{
$placeholders = '?' . str_repeat(',?', count($ids) - 1);
$stmt = $db->prepare("select * from mytable where id in(" . $placeholders .
")");
$stmt->execute($ids);
}
?>