i have a mysql select query statement like this using php,
$rrt = implode(',',array_fill(0,count($ees),'?'));
$rrr = implode(',',array_fill(0,count($array),'?'));
$select = $con ->prepare("SELECT name from table WHERE name NOT IN ($array) AND ageNOT IN ($rrt) GROUP BY name ");
i have tried:
$select = $con ->prepare("SELECT name from table WHERE name NOT IN ($rrr) AND age NOT IN ($rrt) GROUP BY name ");
$select->($array);
error output
Fatal error: Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in
$select = $con ->prepare("SELECT name from table WHERE name NOT IN ($array) AND age NOT IN ($rrt) GROUP BY name ");
$select -> bindParam(1,$array);
$select -> bindParam(2,$ees);
$select -> execute();
error output
Fatal error: Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in
$select = $con ->prepare("SELECT name from table WHERE name NOT IN ('".implode('","',$array)."') AND ageNOT IN ($rrt) GROUP BY name ");
$select -> execute($ees);
this one gave some results but not what i want; i want to use a query like this :
$select = $con ->prepare("SELECT name from table WHERE name NOT IN ($array) AND age NOT IN ($rrt) GROUP BY name ");
$select -> execute($ees);
but i dont want to be getting number of parameter bound error, please help! thanks in advance.