PHP Registrationdatabase:最后一行出错

时间:2017-02-02 20:32:07

标签: php mysqli

<?php
session_start();

$db = mysqli_connect("localhost", "root", "", "authentication");

if(isset($_POST['register_btn']))
{
    $username = mysql_real_escape_string($_POST['username']);
    $password = mysql_real_escape_string($_POST['password']);
    $password2 = mysql_real_escape_string($_POST['password2']);

    if ($password == $password2 )
    {
        $password = md5($password);
        $sql = "INSERT INTO users(username, password) VALUES('$username', '$password')";
        mysqli_query($db, $sql);
        $_SESSION['message'] = "You are now logged in";
        $_SESSION['username'] = $username;
        header("location: home.php");
    }else
    {
        $_SESSION['message'] = "The two passwords do not match";
    }
?>

当我启动我的网站时,它会发出而不是加载网站:

  

解析错误:语法错误,第86行的C:\ xampp \ htdocs \ newFavouriteMovies \ register.php中的文件意外结束

第86行是php文件的最后一行,我没有显示整个项目。

0 个答案:

没有答案