SELECTING WHERE ID from array in a php-mysql query
Posted: 14 Dec 2014, 08:11
I'm trying to SELECT from a PHP array inside a mysql query.
$ids has been created by $_POST and exploded into an array. It can be [ 2 ] or [2,4,12] for example. Not sure whether to implode back into string or not.
I need to be selecting the rows with id 2 OR 4 OR 12 ...
Code: Select all
$sql = "SELECT * FROM table WHERE id = $ids ";
I need to be selecting the rows with id 2 OR 4 OR 12 ...