我可以在参数
示例中使用几行吗
SELECT id, city_id FROM an_objects WHERE city_id IN (:arrCity)
(:arrCity) (1,2,3,4,5,6)
但现在我已经这样做了
SELECT id, city_id FROM an_objects WHERE city_id IN (:1p, :2p, :3p, ...... :100p)
而且非常糟糕
<?php
private function PDOBindArray(&$poStatement, &$paArray){
foreach ($paArray as $k=>$v) {
@$poStatement->bindValue($k, $v[0], $v[1]);
}
}
// the array structure should now look something like this
$inputArray = array(
':arrcity' => array($email, PDO::PARAM_STR),
':another_variable' => array($pass, PDO::PARAM_INT)
);
?>
在这种情况下如何成为查询?
WHERE city_id IN (:1p, :2p, :3p, ...... :100p)
在查询100个参数
这个方法中,例如我们只有5个参数
private function PDOBindArray(&$poStatement, &$paArray){
foreach ($paArray as $k=>$v) {
@$poStatement->bindValue($k, $v[0], $v[1]);
}
}