Warum erhalte ich diese Fehlermeldung:Objekt konnte nicht in Zeichenfolge konvertiert werden?
Catchable fatal error: Object of class Card could not be converted to string in /f5/debate/public/Card.php on line 79
Hier den Code ist:
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 Line ist die $query
und die Funktion ist Teil der Klasse Card
)
Alle Erklärungen von Card
:
public $type;
public $tag;
public $title;
public $source;
public $text;
public function __construct() {
$this->date = new Date;
$this->author = new Author;
}
Nach Zeile Ändern 79 dazu:
$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')";
ich jetzt diesen Fehler:
Catchable fatal error: Object of class Author could not be converted to string in /f5/debate/public/Card.php on line 79
Das liegt an '$ this- $ author-> qualifications' – quantumSoup