Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- /**
- * Description of DbReport
- *
- * @author ote
- */
- class DbReport {
- private $sqlresult = array(
- //rij0
- Array("Klusser" => "Bep van Veen",
- "Klus" => "Bijles: Nederlands",
- "Client" => "Henk van Dijk",
- "Punten" => "6",
- "Beoordeling" => " "),
- //rij1
- Array("Klusser" => "Jolanda Vleermuis",
- "Klus" => "Kleding reperatie",
- "Client" => "Bep van Veen",
- "Punten" => "1",
- "Beoordeling" => " "),
- //rij2
- Array("Klusser" => "Hans de Jong",
- "Klus" => "Koelkast reperatie",
- "Client" => "Willem van Buuren",
- "Punten" => "2",
- "Beoordeling" => " ") );
- private $index;
- private $foutmelding;
- private $db;
- public function getReportData() {
- $result = False;
- $servername = "localhost";
- $username = "rot";
- $password = "";
- $dbName = "Klusforce1";
- try {
- $conn = new PDO("mysql:host=$servername;dbname=".$dbName.",".$username,".$password");
- // set the PDO error mode to exception
- $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- echo "Connected successfully";
- $sql = "SELECT * FROM klus";
- $command = $conn->query($sql);
- // $result = TRUE;
- }
- catch(PDOException $e)
- {
- $this->foutmelding = $e->getMessage();
- }
- return $result;
- }
- public function selectFirst(){
- $this->index = 0;
- }
- public function selectNext(){
- $this->index ++;
- }
- public function isEndOfData(){
- return $this->index == sizeof($this->sqlresult);
- }
- public function getPunten(){
- return $this->sqlresult[$this->index]["Punten"];
- }
- public function getKlusNaam(){
- return $this->sqlresult[$this->index]["Klus"];
- }
- public function getBeoordeling(){
- return $this->sqlresult[$this->index]["Beoordeling"];
- }
- public function getClientNaam(){
- return $this->sqlresult[$this->index]["Client"];
- }
- public function getAanbiederNaam(){
- return $this->sqlresult[$this->index]["Klusser"];
- }
- public function getFoutmelding(){
- return $this->foutmelding;
- }
- //put your code here
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement