Guest User

Untitled

a guest
Nov 27th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. <html>
  2.  
  3. <head>
  4.  
  5. </head>
  6.  
  7. <body>
  8.  
  9. <form action="delete.php" method="post">
  10. id: <input type="text" name="id">
  11. <input type="submit" value="ok">
  12. <?php
  13. $servername = "localhost";
  14. $username = "root";
  15. $password = "";
  16. $dbname = "uni";
  17.  
  18. $conn = new mysqli("localhost","root","",'uni');
  19. if ($conn->connect_error) {
  20. die("Connection failed: " . $conn->connect_error);
  21. }
  22.  
  23. $sql = "DELETE FROM student WHERE id=3";
  24.  
  25. if ($conn->query($sql) === TRUE) {
  26. echo "successful";
  27. } else {
  28. echo "error: " . $conn->error;
  29. }
  30.  
  31. $conn->close();
  32. ?>
  33.  
  34. </form>
  35. </body>
  36.  
  37. </html>
Add Comment
Please, Sign In to add comment