I wonder if there is a way to pass some values into the parameters option on the sqlsrv_query
function.
I tried a few things but could not get it to work.
This query is what I want to be executed:
SELECT id, name, etc
FROM sqlTable
WHERE id IN ('1','2','100','314')
I want to pass the WHERE
IN
values using the params option, like this:
$q ="SELECT id FROM sqlTable WHERE id IN ?";
$p = array(array('1','2','100','314'));
sqlsrv_query($connection, $q, $p);
Right now I'm passing the values directly into the query string, but for obvious security reasons I want to pass them as parameters into the function. Anyone any idea on how to achieve this?