Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="pl">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Dziennik szkolny</title>
  6.  
  7. <meta http-equiv="X-Ua-Compatible" content="IE=edge">
  8. <link rel="stylesheet" href="main.css">
  9.  
  10. </head>
  11.  
  12. <body>
  13. <form
  14. <?php
  15.  
  16.  
  17.  
  18.  
  19. require_once "dbconnect.php";
  20.  
  21. $conn = mysqli_connect($host, $user, $pass, $db) or die("Błąd połączenia!");
  22.  
  23. mysqli_set_charset($conn, "utf8");
  24.  
  25. /*if(!$conn)
  26. {
  27. echo "Błąd połączenia!";
  28. }
  29. else
  30. {
  31. echo "Hurra!";
  32. }*/
  33.  
  34. $klasa = $_POST["klient"];
  35.  
  36. $q = "SELECT Imie, Nazwisko, adres FROM klient";
  37.  
  38. $result = mysqli_query($conn, $q) or die("Problemy z odczytem danych!");
  39.  
  40. $ile = mysqli_num_rows($result);
  41.  
  42. if($ile == 0)
  43. {
  44. echo '<span style="color:red;">Nie ma takiej klasy w szkole!</span>';
  45. }
  46. else
  47. {
  48.  
  49. echo<<<END
  50.  
  51. <table>
  52. <thead>
  53. <tr>
  54. <th>Imię</th>
  55. <th>Nazwisko</th>
  56. <th>adres</th>
  57. </tr>
  58. </thead>
  59. <tbody>
  60.  
  61. END;
  62. $suma = 0;
  63.  
  64. while($row = mysqli_fetch_assoc($result))
  65. {
  66. echo "\r\n\t\t\t<tr>";
  67. foreach($row as $col)
  68. {
  69. echo "<td>$col</td>";
  70.  
  71. }
  72. echo "</tr>";
  73.  
  74.  
  75. //echo "\r\n\t\t\t<tr><td>".$row['Imie']."</td><td>".$row['Nazwisko']."</td><td>".$row['adres']."</td></tr>";
  76. }
  77. echo<<<END
  78. \r\n
  79. </tbody>
  80. </table>
  81. END;
  82.  
  83. }
  84.  
  85. mysqli_close($conn);
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94. ?>
  95.  
  96. </body>
  97. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement