I have two table, one of users, and one of validation codes.
I do a code check in PHP and need to query the validation table at the same time that I update this table by disabling this code so that it is not validated again, and enable the user if the code is correct. p>
So I'm doing the update this way:
UPDATE 'verificaconta' as 'verif'
INNER JOIN 'sysusuarios' as 'usuarios' ON 'usuarios'.'cod' = 'verif'.'cod'
SET 'verif'.'ativo' = '0', 'usuarios'.'ativo' ='1'
WHERE 'verif'.'codvalidacao' = ?'
And I was returning the following error:
Error Code: 1175. You are using safe update mode and you tried to update a table without WHERE that uses a KEY column to disable safe mode, toggle the option in Preferences - > SQL Editor and reconnect.
I researched google and advised using: SET SQL_SAFE_UPDATES = 0;
I then did this:
SET SQL_SAFE_UPDATES = 0;
UPDATE 'verificaconta' as 'verif'
INNER JOIN 'sysusuarios' as 'usuarios' ON 'usuarios'.'cod' = 'verif'.'cod'
SET 'verif'.'ativo' = '0', 'usuarios'.'ativo' ='1'
WHERE 'verif'.'codvalidacao' = ?'
SET SQL_SAFE_UPDATES = 1;
On my local server, it worked fine, but when I try to run on the web server, it can not make the change.
Is there another way to perform this update in a single query without having to do a separate select from the update ??
---------- EDIT ----------------
sysusuarios TABLE
VerificationTABLE