这是我的问题:
$row = mysqli_fetch_object(mysqli_query("SELECT * FROM `page` AS p LEFT JOIN `page_settings` AS s ON p.id = s.page_id WHERE p.id = '".$this->id."'"));
echo $row->title;
此查询返回如下错误:
Notice: Trying to get property of non-object in...
但是当我尝试这个查询时:
$row = mysqli_fetch_object(mysqli_query("SELECT * FROM `page` WHERE id = '".$this->id."'"));
echo $row->title;
完美无缺。我什么都不懂。
答案 0 :(得分:1)
您收到Trying to get property of non-object
错误的原因是因为您的查询未通过,因此它不是对象,而是错误消息(在某些情况下为null)。
答案是,因为您的查询失败了。