I would like to run a simple select query using 'where in' clause with mysql pdo.
$start = 12; $end = 14;
for($i=$start; $i<=$end;$i++)
{
$limitin[] = array($qstep,$i);
}
The array is
Array
(
[0] => Array
(
[0] => 3
[1] => 12
)
[1] => Array
(
[0] => 3
[1] => 13
)
[2] => Array
(
[0] => 3
[1] => 14
)
)
Then
$questionmarks = str_repeat("?,", count($limitin)-1) . "?";
and the query is
$getans = $this->db->prepare("SELECT *
FROM answers
WHERE qstep = ?
and ansid in ($questionmarks) ");
$getans->execute($limitin); //$limitin is the array.
I am getting a blank resultset and a notice which is 'Notice: Array to string conversion '