Mysql Query does not work with many arguments

0

I would like to ask you for help identifying the reason why my update query does not work. I have the following problem, the query below works normally:

$conn->query("UPDATE dados_cadastrais SET 
nome='$nome',sobrenome='$sobrenome',nascimento='$nascimento',cpf='$cpf',cep='$cep',logradouro='$logradouro',bairro='$bairro',localidade='$localidade',uf='$uf',ibge='$ibge',numero='$numero',usuario='$usuario',senha='$senha'")

But there is no WHERE clause pointed out, but when I put it in, it does not recognize WHERE as a part of the query or anything after it, I have tried everything and can not find where the error is (if there is any error), or some other way to do this, follow the image of how it is in the text editor (use the Atom):

Thank you in advance for the help, I already researched everything that was possible and did not find anything similar to my problem.

    
asked by anonymous 29.04.2018 / 00:43

2 answers

0

try to pass as string, using apostrophes
probably php is ignoring this

$conn->query("UPDATE dados_cadastrais SET 
nome='$nome',
sobrenome='$sobrenome',
nascimento='$nascimento',
cpf='$cpf',
cep='$cep',
logradouro='$logradouro',
bairro='$bairro',
localidade='$localidade',
uf='$uf',
ibge='$ibge',
numero='$numero',
usuario='$usuario',
senha='$senha'
Where id = '$id' ");
    
29.04.2018 / 01:00
0

Thanks for the help of everyone, I tried everything that was shown but what solved it was to concatenate the query in 2 lines, I did not quite understand why, but it looked like this:

    
29.04.2018 / 02:11