为什么我得到这个错误:
Catchable fatal error: Object of class Card could not be converted to
string in /f5/debate/public/Card.PHP on line 79
这是代码:
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); }
卡的所有声明:
public $type; public $tag; public $title; public $source; public $text; public function __construct() { $this->date = new Date; $this->author = new Author; }
将79行更改为:
$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')";
我现在得到这个错误:
Catchable fatal error: Object of class Author could not be converted
to string in /f5/debate/public/Card.PHP on line 79