Good Day,
Right now Im having a hard time figuring if is it possible to have an IF ELSE function inside an sql query. I want to DELETE a row with same location and name, then UPDATE if not exist.
$sql = "IF EXISTS (SELECT * FROM location_tbl WHERE name = '$a' && location = 'Drawing Room')
DELETE FROM location_tbl WHERE name = '$a'
ELSE
INSERT INTO location_tbl (id, name, datetime, location) VALUES ('', '$a' , NOW(),'Drawing Room')";
Thank you so much for your KIND HELP