Advertisement
Guest User

[PHP]Tommy

a guest
Sep 18th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1.  
  2. //polaczenie.php
  3. <?php
  4.  
  5. $host ="localhost";
  6. $db_user = "root";
  7. $db_password ="";
  8. $db_name = "tomek";
  9.  
  10. ?>
  11. //index
  12. <?php
  13.  
  14. require_once "connect.php";
  15.  
  16. $polaczenie = @new mysqli($host,$db_user,$db_password,$db_name);
  17.  
  18. class dane
  19. {
  20. public $id, $imie, $nazwisko, $adres, $telefon;
  21.  
  22. static function wykonaj($id, $imie, $nazwisko, $adres, $telefon)
  23. {
  24. $zapytanie = "INSERT INTO dane(id, imie, nazwisko, adres, telefon) VALUES ('$id','$imie','$nazwisko','$adres','$telefon')";
  25.  
  26. }
  27.  
  28. static function pobierz()
  29. {
  30. $z = $mysqli->query("SELECT id,imie, nazwisko,adres,telefon FROM dane");
  31. while ($r = $z->fetch_assoc()) {
  32. echo ".Id: " . $r["id"] . ".Imię: " . $r["imie"] . ", nazwisko: " . $r["nazwisko"] . ".adres: " . $r["adres"] . ".telefon: " . $r["telefon"] . "";
  33. }
  34. }
  35.  
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement