解析错误:语法错误,第781行意外T_VARIABLE

时间:2013-06-16 21:03:19

标签: php

解析错误:语法错误,第781行意外T_VARIABLE

我无法看到错误,无论我喝多少咖啡,都需要第二双眼睛......请帮助

if(!$this->DBLogin())
    {
        $this->HandleError("Database login failed!");
        return false;
    }
    if(!$this->Ensuretable())
    {
        return false;
    }

    $username = $_POST['username']
    // $username = $this->SanitizeForSQL($username);

$qry = "Select * from $this->tablename where username='$username'"; // LINE 781

    $result = mysql_query($qry,$this->connection);

    if(!$result || mysql_num_rows($result) <= 0)
    {
        $this->HandleError("Error selection. The UserName was not found");
        return false;
    }

    $row = mysql_fetch_assoc($result);

1 个答案:

答案 0 :(得分:1)

您缺少导致;

的分号T_ERROR
$username = $_POST['username'];
                            //^here is missing

由于不推荐使用旁注mysql_*函数,最好切换为PDOmysqli并使用预准备语句以避免mysql injections的任何风险,请在此处了解详情{ {3}}