Given an array of ids $galleries = array(1,2,5) I want to have a SQL query that uses the values of the array in its WHERE clause like:
$galleries = array(1,2,5)
Assuming you properly sanitize your inputs beforehand...
$matches = implode(',', $galleries);
Then just adjust your query:
SELECT * FROM galleries WHERE id IN ( $matches )
Quote values appropriately depending on your dataset.