解析错误:语法错误,意外' $ encrypt_password' (T_VARIABLE)在第2行的代码中

时间:2015-10-10 22:15:13

标签: php syntax-error

嗨,我是PHP新手,但到目前为止,我认为非常好。

我在这行收到语法错误:$ encrypt_ppassword = md5($ newpass);

任何人都可以帮忙/告诉我原因吗?

<?php
        $id = $_SESSION['user_id'];
        $email = $_POST['email'];
        if (isset($_POST['submit'])) {
            ## connect mysql server
                $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
                # check connection
                if ($mysqli->connect_errno) {
                    echo "<p>MySQL error no {$mysqli->connect_errno} : {$mysqli->connect_error}</p>";
                    exit();
                }     
            ## query database
                # fetch data from mysql database
                $sql = "SELECT email FROM users WHERE email LIKE '{$_POST['email']}' LIMIT 1";

                if ($result = $mysqli->query($sql)) {
                    $user = $result->fetch_array(); 
                } else {
                    echo "<p>MySQL error no {$mysqli->errno} : {$mysqli->error}</p>";
                    exit();
                }

                $username = $user['username'];
            if ($result->num_rows == 1) {
                $newpass = random_password();
                $newpass2 = $newpass
                $encrypt_password=md5($newpass);
$sql = "UPDATE users SET password = '{$encrypt_password}' WHERE id ={$id}";
                   if ($mysqli->query($sql)) {
                    $mailer->sendpass($username,$email,$newpass2);
                        redirect_to("forgot.php?msg=Reset Successfully");
                         }
        }  
        else {
                echo "<p>Sorry, no user found with this email.</p>";
            }
        }

                    if(isset($_GET['msg'])) {
    echo "<p style='color:red;'>".$_GET['msg']."</p>";
}
    ?>       

出于某种原因,我可以让我的changepassword页面工作,我的邮件工作和加密功能,但当我把它们放在一起时,他们不会大声笑

1 个答案:

答案 0 :(得分:1)

之前的一行在最后错过App.Current.MainWindow.Width = 500; App.Current.MainWindow.Height = 500;