Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title> Zadanie 6.1 </title>
  4. </head>
  5. <body>
  6.  
  7.  
  8. <?php
  9. $servername = "localhost";
  10. $username = "root";
  11. $password = "";
  12. $dbname = "studenci";
  13.  
  14. $conn = new mysqli($servername, $username, $password, $dbname);
  15. if ($conn->connect_error) {
  16. die("Connection failed: " . $conn->connect_error);
  17. }
  18.  
  19.  
  20. $sql = "SELECT idstudent, imie, nazwisko, grupa FROM student";
  21. $result = $conn->query($sql);
  22.  
  23. echo "<table border='1'>";
  24. echo '<tr>';
  25. echo '<td> idstudent </td>';
  26. echo '<td> imie </td>';
  27. echo '<td> nazwisko </td>';
  28. echo '<td> grupa </td>';
  29.  
  30. echo '</tr>';
  31. if ($result->num_rows > 0) {
  32. while($row = $result->fetch_assoc()) {
  33. $id = $row['idstudent'];
  34. echo "<tr><td>" . $row["idstudent"]. " </td><td> " . $row["imie"]. " </td><td> " . $row["nazwisko"]. " </td><td> "
  35. .$row['grupa']. "</td>".'<td><a href="strona_usuwajaca_rekord.php?action=delete&id='.$id.'">Usuń</td></tr>';
  36. }
  37. } else {
  38. echo "0 results";
  39. }
  40.  
  41. echo '</table>';
  42.  
  43.  
  44.  
  45.  
  46. $conn->close();
  47. ?>
  48. <fieldset>
  49. <legend> Dodaj studenta </legend>
  50. <form action ="dodawanie.php" method ="POST">
  51. <input type="submit" value="dodaj studenta"><br>
  52. </form>
  53. </fieldset>
  54. </body>
  55. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement