SQL Server : PDO `IN` statement syntax -
how can write following request using pdo?
$query = "select test table cond in(1,2,3)";
i tried this, not working:
$query = "select test table cond in(?)"; $params = array($condarray); $result = sqlsrv_query($connconfig, $query, $params) ;
@your common sense comment trick.
reference - asked questions pdo
$ids = array(1,2,3); $in = str_repeat('?,', count($arr) - 1) . '?'; $sql = "select * table column in ($in)"; $stm = $db->prepare($sql); $stm->execute($ids); $data = $stm->fetchall();
Comments
Post a Comment