Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. <?php
  2. require '../Objekte/Kunde.inc.php';
  3.  
  4. class DBKundenTool{
  5. function __construct(){
  6.  
  7. }
  8.  
  9. function getCustomerList(){
  10. $db=new mysqli("localhost","root","","kundendb");
  11. //var_dump($db);
  12. $query="SELECT * FROM tblKunde";
  13. $result=$db->query($query);
  14.  
  15. $kundenListe=array();
  16.  
  17.  
  18.  
  19. while ($row=$result->fetch_object()) {
  20. $kundenListe[]=new Kunde($row->Anrede, $row->Vorname, $row->Nachname);
  21. }
  22.  
  23. $db->close();
  24. return $kundenListe;
  25. }
  26.  
  27. }
  28. $dbKunden=new DBKundenTool();
  29. $liste=$dbKunden->getCustomerList();
  30. var_dump($liste);
  31. for ($i=0;$i < count($liste);$i++) {
  32. echo $liste[$i]->nachname;
  33.  
  34. }
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement