Пример #1
0
 public function getById($id)
 {
     $dbh = new PDO(DBConfig::$DB_CONNSTRING, DBConfig::$DB_USERNAME, DBConfig::$DB_PASSWORD);
     $sql = "select id, omschrijving, prijs from beleg where id ='" . $id . "'";
     $resultSet = $dbh->query($sql);
     $rij = $resultSet->fetch();
     $beleg = Beleg::create($rij["id"], $rij["omschrijving"], $rij["prijs"]);
     $dbh = null;
     return $beleg;
 }
Пример #2
0
 public function getAll()
 {
     $sql = "select * from beleg";
     $dbh = new PDO(DBConfig::$DB_CONNSTRING, DBConfig::$DB_USERNAME, DBConfig::$DB_PASSWORD);
     $resultSet = $dbh->query($sql);
     $lijst = array();
     foreach ($resultSet as $rij) {
         $beleg = Beleg::create($rij["id"], $rij["belegsoort"], $rij["prijs"]);
         array_push($lijst, $beleg);
     }
     $dbh = null;
     return $lijst;
 }