I have the following php-code which works fine:
$sql="UPDATE `fa` SET `group` = '27',`locked` = '1' WHERE `send` LIKE '%Amazon%' AND `Locked` =0";
$result=mysqli_query($conn,$sql);
$sql="UPDATE `fa` SET `group` = '27',`locked` = '1' WHERE `send` LIKE '%ebay%' AND `Locked` =0";
$result=mysqli_query($conn,$sql);
$sql="UPDATE `fa` SET `group` = '27',`locked` = '1' WHERE `send` LIKE '%google%' AND `Locked` =0";
$result=mysqli_query($conn,$sql);
Is there a way to put those lines into one line? Just to clean up the code.
You can use OR
:
update `fa`
set `group` = '27',
`locked` = '1'
where (
`send` like '%Amazon%'
or `send` like '%ebay%'
or `send` like '%google%'
)
and `Locked` = 0
You can use OR
and AND
together.
WHERE (`send` LIKE '%Amazon%' OR `send` LIKE '%ebay%' OR `send` LIKE '%google%') AND `Locked` =0