<?php class addNews { public $title; public $content; public $author; public function addTitle($title){ $this->title = $title; } public function addContent($content){ $this->content = $content; } public function addAuthor($author){ $this->author = $author; } public function save(){ try{ require_once('pdo.php'); $ins = $pdo->exec('INSERT INTO `news` (`title`, `content`, `author`) VALUES ('$this->title', '$this->content', '$this->author')'); } catch(PDOExeptions $e){ } } } ?>
Lecz non stop wywala mi błąd, Parse error: syntax error, unexpected T_VARIABLE in D:\Projekty\vs\class.addnews.php on line 33 , próbowałem już na różne sposoby i jedynym sukcesem było insertowanie danych jako całego stringa $this->title, $this->content, $this->author. Wiecie może gdzie znajduje się problem??