Advertisement
Guest User

Untitled

a guest
Apr 17th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. <?php
  2. include('connect.php');
  3.  
  4. class pobierz
  5. {
  6. public $host;
  7. public $db_user;
  8. public $db_password;
  9. public $db_name;
  10. public $lacz;
  11. public $sql;
  12. public $rezultat;
  13. public $wiersz;
  14. public $tytul;
  15. public $opis;
  16. public $onenav;
  17. public $twonav;
  18. public $threenav;
  19. public $fournav;
  20.  
  21. public function wyjmij()
  22. {
  23. if($this->lacz = mysqli_connect($this->host, $this->db_user, $this->db_password, $this->db_name))
  24. {
  25. if($this->rezultat = $this->lacz->query($this->sql))
  26. {
  27. $this->wiersz = $this->rezultat->fetch_assoc();
  28.  
  29. $this->tytul = $this->wiersz['tytul'];
  30. $this->opis = $this->wiersz['opis'];
  31. $this->onenav = $this->wiersz['onenav'];
  32. $this->twonav = $this->wiersz['twonav'];
  33. $this->threenav = $this->wiersz['threenav'];
  34. $this->fournav = $this->wiersz['fournav'];
  35. }
  36. }
  37. else
  38. {
  39. echo "Nie działa";
  40. }
  41. }
  42. }
  43. class settings
  44. {
  45. public $title;
  46. public $description;
  47. public $onenav;
  48. public $twonav;
  49. public $threenav;
  50. public $fournav;
  51. }
  52.  
  53. $polaczenie = new pobierz;
  54.  
  55. $polaczenie->host = $host;
  56. $polaczenie->db_user = $db_user;
  57. $polaczenie->db_password = $db_password;
  58. $polaczenie->db_name = $db_name;
  59. $polaczenie->sql = "SELECT * FROM `settings`";
  60.  
  61. $polaczenie->wyjmij();
  62.  
  63. $set = new settings;
  64.  
  65. $set->title = $polaczenie->tytul;
  66. $set->description = $polaczenie->opis;
  67. $set->onenav = $polaczenie->onenav;
  68. $set->twonav = $polaczenie->twonav;
  69. $set->threenav = $polaczenie->threenav;
  70. $set->fournav = $polaczenie->fournav;
  71.  
  72. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement