How to create a query list of ID numbers using join from an $array and put into a string that can be used in a MySQL query:

$id_numbers = array(1,6,14,32,84,27,49,77);
$complist = join(”,”, $id_numbers);
$query = “SELECT id from tablename WHERE id IN($complist)”;