I'm using Ecplise and I'm getting strange syntax errors, it says there are four errors each located on the line before each function declaration (except for the constructor). I really don't know where it can come from, I checked every line and I see no "{}" or ";" problems...
<?php
require_once('SqliteConnection.php');
class TrajetDAO {
private static $dao;
private function __construct() {
}
public final static function getInstance() {
if(!isset(self::$dao)) {
self::$dao= new TrajetDAO();
}
return self::$dao;
}
public final function findAll() {
$dbc = SqliteConnection::getInstance()->getConnection();
$query = "select * from Trajet order by num";
$stmt = $dbc->query($query);
$results = $stmt->fetchALL(PDO::FETCH_CLASS, ’Trajet’);
return $results;
}
public final function insert(DataObject $st){
if($st instanceof Trajet){
$dbc = SqliteConnection::getInstance()->getConnection();
// prepare the SQL statement
$query = "insert into Trajet(num, description, dateCrea) values (:n,:de,:da)";
$stmt = $dbc->prepare($query);
// bind the paramaters
$stmt->bindValue(":n",$st->getNum(),PDO::PARAM_STR);
$stmt->bindValue(":de",$st->getDescription(),PDO::PARAM_STR);
$stmt->bindValue(":da",$st->getdateCrea(),PDO::PARAM_STR);
// execute the prepared statement
$stmt->execute($data);
}
}
public function delete(DataObject $obj) {
$dbc = SqliteConnection::getInstance()->getConnection();
$query = $dbConnection->prepare('DELETE FROM Trajet WHERE num='.$Trajet->getNum().';');
$query->execute();
}
public function update(DataObject $obj) {
$dbc = SqliteConnection::getInstance()->getConnection();
$query=$dbConnection->prepare('UPDATE Trajet SET num='.$Trajet->getNum().',description='.$Trajet->getDescription().',dateCrea='.$teacher->getDateCrea(). 'WHERE num='.$Trajet->getNum().';');
$query->execute();
}
}
?>