I’m trying to make a mySQL query that updates a field called “connected” to 1 ONLY IF user1 = derp AND user2=derpette or the opposite. I’m having ad difficult time with the syntax. I read some of the other threads on overflow, which led me to creating the following query. If anyone could provide me any suggestions towards the correct syntax or perhaps provides an alternate solution to this problem, it would be greatly appreciated. Thanks.
UPDATE xGames
SET connected = 1
WHERE ((user1 = 'derp' AND user2 = 'derpette')
OR (user2='derpette' AND user1='derp'))
I’m not sure if you’re getting a syntax error, or if it just isn’t behaving as you expect, but you didn’t reverse the conditions – you only reversed the ORDER of the same conditions…