check database for array of values

check database for array of values

example:UPDATE tableName SET someColumn = “updated” WHERE id IN(1, 88, 99, 152)

so it can be done by

for($i = 0; $i < count($arrayOfIDs) $i++)
{
if($i == 0)
$concatenatedIDs .= $arrayOfIDs[$i];
else
$concatenatedIDs .= ‘,’ . $arrayOfIDs[$i];
}

$query = ‘UPDATE tableName SET someColumn = “updated” WHERE id IN(‘ . $concatenatedIDs . ‘)’;

%d bloggers like this: