Почему я получаю эту ошибку:
Допустимая фатальная ошибка: объект класса Card не может быть преобразован в строка в /f 5/debate/public/Card.php в строке 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);
}
(строка 79 - это $query
, и эта функция является частью класса Card
)
Все объявления Card
:
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')";
Теперь я получаю эту ошибку:
Обрезаемая фатальная ошибка: объект класса Автор не может быть преобразован для строки в /f 5/debate/public/Card.php в строке 79