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 . ‘)’;

You may also like...

Creating a Shopify App using Laravel How to Create Custom WordPress Plugin? How to Build a Telegram Bot using PHP How to Convert Magento 2 into PWA?