Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. <?php
  2. include "config.php";
  3.  
  4. if (!isset($_POST['id'])) {
  5. echo '("status": "Error", "message": "Word ID required.")';
  6. exit();
  7.  
  8. }
  9.  
  10. $id = $_POST['id'];
  11. $sql = "DELETE FROM word WHERE id='$id'";
  12.  
  13. if(mysqli_query($conn, $sql)){
  14. if (mysqli_affected_rows($conn) > 0) {
  15. echo '("Status":"Success")';
  16. }else{
  17. echo '("status": "Error","message":"No word with corresponding ID.")';
  18. }
  19. }
  20. else{
  21. echo '("status": "Error","message": "'.mysqli_error($conn) .'")';
  22. }
  23.  
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement