Advertisement
Guest User

Untitled

a guest
Oct 12th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.82 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4. * To change this license header, choose License Headers in Project Properties.
  5. * To change this template file, choose Tools | Templates
  6. * and open the template in the editor.
  7. */
  8.  
  9. /**
  10. * Description of DbReport
  11. *
  12. * @author ote
  13. */
  14. class DbReport {
  15. private $sqlresult = array(
  16. //rij0
  17. Array("Klusser" => "Bep van Veen",
  18. "Klus" => "Bijles: Nederlands",
  19. "Client" => "Henk van Dijk",
  20. "Punten" => "6",
  21. "Beoordeling" => " "),
  22.  
  23. //rij1
  24. Array("Klusser" => "Jolanda Vleermuis",
  25. "Klus" => "Kleding reperatie",
  26. "Client" => "Bep van Veen",
  27. "Punten" => "1",
  28. "Beoordeling" => " "),
  29.  
  30. //rij2
  31. Array("Klusser" => "Hans de Jong",
  32. "Klus" => "Koelkast reperatie",
  33. "Client" => "Willem van Buuren",
  34. "Punten" => "2",
  35. "Beoordeling" => " ") );
  36.  
  37. private $index;
  38. private $foutmelding;
  39. private $db;
  40.  
  41.  
  42.  
  43. public function getReportData() {
  44. $result = False;
  45. $servername = "localhost";
  46. $username = "rot";
  47. $password = "";
  48. $dbName = "Klusforce1";
  49.  
  50. try {
  51. $conn = new PDO("mysql:host=$servername;dbname=".$dbName.",".$username,".$password");
  52. // set the PDO error mode to exception
  53. $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  54. echo "Connected successfully";
  55. $sql = "SELECT * FROM klus";
  56. $command = $conn->query($sql);
  57. // $result = TRUE;
  58. }
  59. catch(PDOException $e)
  60. {
  61. $this->foutmelding = $e->getMessage();
  62. }
  63. return $result;
  64. }
  65. public function selectFirst(){
  66. $this->index = 0;
  67. }
  68. public function selectNext(){
  69. $this->index ++;
  70. }
  71. public function isEndOfData(){
  72. return $this->index == sizeof($this->sqlresult);
  73. }
  74. public function getPunten(){
  75. return $this->sqlresult[$this->index]["Punten"];
  76. }
  77.  
  78. public function getKlusNaam(){
  79. return $this->sqlresult[$this->index]["Klus"];
  80. }
  81. public function getBeoordeling(){
  82. return $this->sqlresult[$this->index]["Beoordeling"];
  83. }
  84. public function getClientNaam(){
  85. return $this->sqlresult[$this->index]["Client"];
  86. }
  87. public function getAanbiederNaam(){
  88. return $this->sqlresult[$this->index]["Klusser"];
  89. }
  90.  
  91. public function getFoutmelding(){
  92. return $this->foutmelding;
  93. }
  94.  
  95. //put your code here
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement