我收到错误"解析错误:语法错误,意外' - >' (T_OBJECT_OPERATOR)"

时间:2016-08-29 18:24:29

标签: android notepad++ postman

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);**

1 个答案:

答案 0 :(得分:1)

  

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

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

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

没有$它意味着常量,并且由于只有标量数据可以是常量,因此使用带有常量的->在语法上是无效的,因此您面临的错误。