MySQL: SELECT FOR UPDATE
#1

Hello. I want to do a conditional instructions with a SELECT FOR UPDATE. My query looks like this:
pawn Код:
SELECT `Duty` FROM `Employees` WHERE `UID` = '1' FOR UPDATE;
UPDATE `Employees` SET `Duty`
And here I have a question how to develop the condition if the player has a duty == 0 then set on duty == 1 and vice versa?

//EDIT:
I tried with:
pawn Код:
UPDATE `Employees` IF(`Duty` == '1' SET `Duty` = '0' OR `Duty` == '0' SET `Duty` = '1')
but it does not work
Reply
#2

You could try something like what's described in this article.

Putting 2 queries in one mysql_query won't work by the way!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)