【问题标题】:I get an error "Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR)"我收到错误“解析错误:语法错误,意外'->'(T_OBJECT_OPERATOR)”
【发布时间】:2016-08-30 04:02:05
【问题描述】:

this is the error that occurred when I am debugging the program

下面是ERROR发生的代码:

public function does_user_exist($email,$password)
{
$query = "Select * from users where email = '$email' and password='$password'";
**$result = mysqli_query(this -> connection, $query);**

【问题讨论】:

    标签: android notepad++ postman


    【解决方案1】:

    $result = mysqli_query(this -> connection, $query)

    在 PHP 中是 $this,而不是 this。将您的代码修复为如下所示:

    $result = mysqli_query($this->connection, $query);
    

    没有$ 表示常量,并且由于只有标量数据可以是常量,因此将-> 与常量一起使用在语法上是无效的,因此您面临的错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-06-23
      • 2013-07-28
      • 2014-09-08
      • 2012-11-03
      • 2017-03-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多