Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. <html>
  2. <head>
  3. <link rel="stylesheet" href="style.css">
  4. </head>
  5. <body>
  6. <?php
  7. // $imie = $_POST['imie'];
  8. // $nazwisko - $_POST['imie'];
  9. $host = "localhost";
  10. $user = "root";
  11. $pass = "root123";
  12. $db = "biblioteka";
  13. $connection = @new mysqli($host, $user, $pass, $db);
  14. if (mysqli_connect_errno() != 0)
  15. {
  16. echo '<p>Błąd połaczęnia z bazą' . mysqli_connect_error();
  17. }
  18. else
  19. {
  20. $wynik = $connection -> query('SELECT * FROM autorzy');
  21. if ($wynik == false)
  22. {
  23. echo '<p>Zapytanie nie zostało wykonane porpawnie!</p>';
  24.  
  25. $connection -> close();
  26. }
  27.  
  28. echo '<table>';
  29. echo '<tr>';
  30. echo '<th>Imie</th>';
  31. echo '<th>Nazwisko</th>';
  32. echo '</tr>';
  33. if($wynik->num_rows >0)
  34. {
  35. while($row = $wynik->fetch_assoc())
  36. {
  37. echo "<tr>";
  38. echo "<td>". $row['Imie']."</td>";
  39. echo "<td>". $row['Nazwisko']."</td>";
  40. echo "</tr>";
  41.  
  42.  
  43. }
  44. echo "</table>";
  45. $connection -> close();
  46. }
  47. }
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54. ?>
  55. </body>
  56. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement