Advertisement
Guest User

Untitled

a guest
Nov 9th, 2017
413
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.61 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.  
  4. <head>
  5. <meta charset="utf-8">
  6. <title>Szkoła</title>
  7. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
  8. <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
  9. <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
  10. <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>
  11. </head>
  12.  
  13. <body>
  14. <div class="container">
  15. <div class="jumbotron">
  16. <?php
  17. $servername = "localhost";
  18. $username = "root";
  19. $password = "";
  20. $conn = new mysqli($servername, $username, $password, "uczniowie");
  21. if ($conn->connect_error) {
  22. die("Błąd: " . $conn->connect_error);
  23. }
  24.  
  25. $sql = "SELECT dane.id, dane.imie, dane.nazwisko, oceny.matematyka, oceny.polski, oceny.informatyka
  26. FROM dane
  27. INNER JOIN oceny ON oceny.id_ucznia=dane.id";
  28. $result = $conn->query($sql);
  29. echo "<table border='1' width='100%'> <tr>
  30. <th>ID</th>
  31. <th>Imię</th>
  32. <th>Nazwisko</th>
  33. <th>Matematyka</th>
  34. <th>Informatyka</th>
  35. <th>Polski</th>
  36. </tr>";
  37. if ($result->num_rows > 0) {
  38. while($row = $result->fetch_assoc()) {
  39. echo "<tr>";
  40. echo "<td>" . $row["id"]. "</td><td>" . $row["imie"]. "</td><td>" . $row["nazwisko"]. "</td><td>" . $row["matematyka"]. "</td><td>" . $row["polski"]. "</td><td>" . $row["informatyka"] . "</td>";
  41. echo "</tr>";
  42. }
  43. } else {
  44. echo "Błąd";
  45. }
  46. echo "</table";
  47. ?>
  48.  
  49. </div>
  50. <!--
  51. <form method="post">
  52. <div class="form-group">
  53. <label for="przedmiot">Przedmiot</label>
  54. <input type="text" class="form-control" id="przedmiot" name="przedmiot" required placeholder="Wpisz nazwę przedmiotu">
  55. </div>
  56. <div class="form-group">
  57. <label for="imie">Imię</label>
  58. <input type="text" class="form-control" id="imie" name="imie" required placeholder="Wpisz imię nauczyciela">
  59. </div>
  60. <div class="form-group">
  61. <label for="nazwisko">Nazwisko</label>
  62. <input type="text" class="form-control" id="nazwisko" name="nazwisko" required placeholder="Wpisz nazwisko nauczyciela">
  63. </div>
  64. <div class="form-group">
  65. <label for="wiek">Wiek</label>
  66. <input type="text" class="form-control" id="wiek" name="wiek" required placeholder="Wpisz wiek nauczyciela">
  67. </div>
  68. <button type="submit" class="btn btn-primary">Dodaj</button>
  69. </form>
  70. </div>
  71. -->
  72. <?php
  73. if(isset($_POST['przedmiot'])){
  74.  
  75. $stmt = $conn->prepare("INSERT INTO lekcje (firstname, lastname, email) VALUES (?, ?, ?) UNION");
  76. $stmt->bind_param("sss", $firstname, $lastname, $email);
  77.  
  78. // set parameters and execute
  79. $firstname = $_POST['a'];
  80. $lastname = "Doe";
  81. $email = "john@example.com";
  82. $stmt->execute();
  83.  
  84. $stmt = $conn->prepare("INSERT INTO lekcje (firstname, lastname, email) VALUES (?, ?, ?) UNION");
  85. $stmt->bind_param("sss", $firstname, $lastname, $email);
  86.  
  87. echo "New records created successfully";
  88.  
  89. $stmt->close();
  90.  
  91.  
  92. }
  93.  
  94. $conn-> close();
  95. ?>
  96. </body>
  97.  
  98. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement