为什么密码没有更新?

时间:2018-11-21 02:53:48

标签: php mysqli

我正在尝试通过PHP更新密码,但是当它运行时,它永远不会更新。我相信密码的插入。不确定我是否正确完成了操作。

 <?php
   if(empty($password_err && $confirm_password_err && $old_err)){
        // Prepare an insert statement
            $sql = "UPDATE users SET password = $password WHERE email = $email]";

            if($stmt = mysqli_prepare($link, $sql)){
                // Bind variables to the prepared statement as parameters
                //mysqli_stmt_bind_param($stmt, "s",$param_password);


                // Set parameters
                $password = password_hash($password, PASSWORD_DEFAULT); // Creates a password hash

                        // Attempt to execute the prepared statement
                if(mysqli_stmt_execute($stmt)){
                    // Redirect to login page
                    echo "Password has been updated!";
                }else{
                    echo "Something went wrong. Please try again later.";
                }


            // Close statement
            mysqli_stmt_close($stmt);
            }

    }
?>

0 个答案:

没有答案