setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION) ; } public function listAll() { $this->sth = self::$db->prepare('SELECT * FROM osoba') ; $this->sth->execute() ; $result = $this->sth->fetchAll() ; return $result ; } public function saveRec($obj) { $this->sth = self::$db->prepare('INSERT INTO osoba VALUES ( :fname, :lname, :city) ') ; $this->sth->bindValue(':fname',$obj->fname,PDO::PARAM_STR) ; $this->sth->bindValue(':lname',$obj->lname,PDO::PARAM_STR) ; $this->sth->bindValue(':city',$obj->city,PDO::PARAM_STR) ; $resp = ( $this->sth->execute() ? 'true' : 'false' ) ; return $resp ; } } ?>