Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. while($row = $result->fetch_assoc()) {
  2. $id = $row['idstudent'];
  3. echo "<tr><td>" . $row["idstudent"]. " </td><td> " . $row["imie"]. " </td><td> " . $row["nazwisko"]. " </td><td> "
  4. .$row['grupa']. "</td>".'<td><a href="usuwanie.php?action=delete&id='.$id.'">Usuń</td></tr>';
  5. }
  6.  
  7.  
  8. --------------------------------------------------
  9.  
  10.  
  11. <?php
  12. $servername = "localhost";
  13. $username = "root";
  14. $password = "";
  15. $dbname = "studenci";
  16.  
  17. $conn = new mysqli($servername, $username, $password, $dbname);
  18. if ($conn->connect_error) {
  19. die("Connection failed: " . $conn->connect_error);
  20. }
  21.  
  22. if ($_POST['action']='delete' && isset($_POST['id'])) {
  23. $id = (int) $_POST['idstudent'];
  24. $zapytanie = "DELETE FROM student WHERE idstudent = $id";
  25. $polaczenie->query($zapytanie);
  26. }
  27. $conn->close();
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement