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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -