$ids = array(1, 2, 3, 4);
$ids = join(', ', $ids);
$query = "SELECT * FROM business WHERE business_id IN ($ids)";
// $query => SELECT * FROM business WHERE business_id IN (1, 2, 3, 4)
De sædvanlige SQL-injektionsadvarsler gælder stadig, du vil måske gå gennem id'erne først for at validere eller undslippe dem. Hvis du forventer strenge i stedet for tal, skal du også bruge denne:
$ids = array('a', 'b', 'c', 'd');
$ids = join("', '", $ids);
$query = "SELECT * FROM business WHERE business_id IN ('$ids')";
// $query => SELECT * FROM business WHERE business_id IN ('a', 'b', 'c', 'd')