Hi,
Part of my script updates a user table with a randomly generated password.
The variables are correct and the statement works if I run it manually in mysql. Mysql does not generate any errors and when I wrap the printed results with a test to see if the update worked, my results print fine with all of the correct values. I'm also using this same update statement in another script to change a password and it works fine. I don't get it. Tearing my hair out. Here's the relevant code:
(I'm using Pear and the db connection is fine)
// generate random new password, encrypt and insert into table user
$userid = $result['userId'];
$password = mkpasswd();
$new_pw = md5($password);
$update = $db_object->query("UPDATE user SET password= '$new_pw' WHERE userId = '$userid'") or die(mysql_error());
if ($update) {
echo "$new_pw<br>userid:$userid<br>username: $username<br>email: $email<br>pw: $password<br>";
}
Am I missing something?
Thanks