I have a query:
"SELECT value1 FROM t1 WHERE id = $id"
But I need to replace $id with an array, i.e. locate a value where id could be a value in my array. How do I do that?
Need coffee refill.
$where = ''; foreach($id_array as $id) { $where .= "id = $id OR "; } $where = rtrim($where, ' OR'); $query = "SELECT value1 FROM t1 WHERE $where";
Perfect!!!
One minor thing: I've added a space after OR
' OR' to ' OR '