Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. <?php
  2.  
  3. $nazwaserwera = "127.0.0.1";
  4.  
  5. $user = "Dyrektor";
  6.  
  7. $password = "dyr_123";
  8.  
  9.  
  10.  
  11. $baza = new mysqli($nazwaserwera,$user,$password);
  12.  
  13. mysqli_set_charset($baza,"utf-8");
  14.  
  15. ?>
  16.  
  17.  
  18.  
  19. <!DOCTYPE html>
  20.  
  21. <html lang="pl">
  22.  
  23.  
  24.  
  25. <head>
  26.  
  27. <meta charset="UTF-8">
  28.  
  29.  
  30.  
  31.  
  32.  
  33. </head>
  34.  
  35.  
  36.  
  37. <body>
  38.  
  39. <form action="index.php" method="POST">
  40.  
  41.  
  42.  
  43. <?php
  44.  
  45. echo "<table>";
  46.  
  47. if (isset($_POST['uczen'])){
  48.  
  49. $query="SELECT * FROM `szkola`.`uczen`";
  50.  
  51. if($wynik=$baza->query($query, MYSQLI_STORE_RESULT)){
  52.  
  53. while(list($id,$Nazwisko,$Imie,$Srednia_ocen,$id_klasy) = $wynik->fetch_row())
  54.  
  55. echo "<tr><td>$id</td><td>$Nazwisko</td><td>$Imie</td><td>$Srednia_ocen</td><td>$id_klasy</td></tr>";
  56.  
  57. }
  58.  
  59. echo "</table>";
  60.  
  61. echo "<br><br><a href='index.php'><center><button type='button'>WRÓĆ</button></center></a>";
  62.  
  63. }
  64.  
  65. else if (isset($_POST['klasa'])){
  66.  
  67. $query="SELECT * FROM `szkola`.`klasa`";
  68.  
  69. if($wynik=$baza->query($query, MYSQLI_STORE_RESULT)){
  70.  
  71.  
  72.  
  73. while(list($id,$nazwa) = $wynik->fetch_row())
  74.  
  75. echo "<tr><td>$id</td><td>$nazwa</td></tr>";
  76.  
  77. }
  78.  
  79. echo "</table>";
  80.  
  81. echo "<br><br><a href='index.php'><center><button type='button'>WRÓĆ</button></center></a>";
  82.  
  83. }
  84.  
  85.  
  86.  
  87. else if (isset($_POST['wychowawca'])){
  88.  
  89. $query="SELECT * FROM `szkola`.`wychowawca`";
  90.  
  91. if($wynik=$baza->query($query, MYSQLI_STORE_RESULT)){
  92.  
  93. while(list($id,$imie,$nazwisko,$id_klasy) = $wynik->fetch_row())
  94.  
  95. echo "<tr><td'>$id</td><td>$imie</td><td>$nazwisko</td><td>$id_klasy</td></tr>";
  96.  
  97. }
  98.  
  99. echo "</table>";
  100.  
  101. echo "<br><br><a href='index.php'><center><button type='button'>WRÓĆ</button></center></a>";
  102.  
  103. }
  104.  
  105.  
  106.  
  107. else{
  108.  
  109. echo "<center><input type='submit' name='uczen' value='UCZEŃ'/></center><br>";
  110.  
  111. echo "<center><input type='submit' name='klasa' value='KLASA'/></center><br>";
  112.  
  113. echo "<center><input type='submit' name='wychowawca' value='WYCHOWAWCA'/></center><br>";
  114.  
  115. }
  116.  
  117.  
  118.  
  119. ?>
  120.  
  121.  
  122.  
  123. </form>
  124.  
  125. </body>
  126.  
  127.  
  128.  
  129. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement