Object could not be converted to string?

后端 未结 6 812
逝去的感伤
逝去的感伤 2020-12-10 11:28

Why am I getting this error:

Catchable fatal error: Object of class Card could not be converted to string in /f5/debate/public/Card.php on line 79

6条回答
  •  没有蜡笔的小新
    2020-12-10 12:24

    you shouldn't put $ before property names when you access them:

    public function insert() {
            $mysql = new DB(debate);
            $this->initializeInsert();
            $query = "INSERT INTO cards VALUES('$this->type','$this->tag','$this->author->last','$this->author->first','$this-$author->qualifications','$this->date->year','$this->date->month','$this->date->day','$this->title', '$this->source', '$this->text')";
            $mysql->execute($query);
        }
    

提交回复
热议问题