Vojta Vojta - 1 year ago 94
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 Source

Try enclosing the string vars in quotes

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

and remove unuseful string concat

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download