How do I update the database according to the current values in it. I currently have the following -
mysqli_query($con,
"UPDATE Tasks
SET completed = CASE WHEN completed == 0 THEN 1 ELSE 0 END
WHERE inde=$q");
The above doesn't work but when I try to do
mysqli_query($con,
"UPDATE Tasks
SET completed = 1
WHERE inde=$q");
it changes the value when ever it is 0 which is correct but I also want to change it to 0 when it is 1. Can someone tell me what I am doing wrong