2

I have a problematic query where I can't protect it because PDO doesn't protect the array. Example: (1,2,3 are example ids).

Select store_id FROM store WHERE store_id IN (1,2,3)

My code looked something like

$params['storeId'] = $filter['storeId'];
$types['storeId'] = PDO::PARAM_INT;

$sql = 'Select store_id FROM store WHERE store_id IN (:storeId)'

I event put storeId in loop so I can loop more storeIds ( user input ) but It always queries only one storeId.

Is there a way so I can protect my query ( mySQL IN operator ) with PDO statement. ?

0 Answers0