Vojta Vojta - 2 months ago 17
MySQL Question

Password update not working

can you please review my code? I'm stuck.$result is returning false from some reason and I cannot change user passwd in my database.
Thank you in advance


  • connection is working, doublechecked

  • table users does exist, the same with column password and email



PHP code is

$sql ="UPDATE users". "SET password = $new_pwd "."WHERE email = $email";
$result= mysqli_query($connection,$sql);

Answer

Try enclosing the string vars in quotes

$sql ="UPDATE users  SET password = '$new_pwd' WHERE email = '$email';";

and remove unuseful string concat