2
I have an app that sends an email to the user to confirm their email as soon as they sign up.
Then I have two tables in my internal database, being them USUÁRIOS
and LOGIN
.
In the table of USUÁRIOS
I have the field confirmed, which receives 0
or 1
:
0
if the user has not yet confirmed his email.
1
if the user has already confirmed his email.
In the table of LOGIN
, I have the logged in field, which is user who is currently logged in. Let’s say he has already confirmed his email.
Therefore, I need to select the user who is logged in and update the confirmed field in the users table to 1
.
I did so, but this way it puts as if all users had already confirmed your email:
update = "UPDATE usuarios SET confirmado = '1'";
db = getDataBase();
db.transaction (function (tx){
tx.executeSql (update);
});
In short, I want it to update only the user who is logged in, ie, logado=1
.
If anyone can help.
Put more information about your database, post the structure
– Pedro Augusto
You are not specifying which user to switch to "1", you need to specify which user id to change. Ex:
UPDATE usuarios SET confirmado = '1' WHERE usuarios.id = 1
– Zulian
you need to pass the user code as a condition for Update
– Danielle Arruda torres
I think you need to add
where logado = 1
. See the answer already given and confirm, which condition you need, so the answer will be edited and you can accept.– Melissa