Advertisement
Guest User

Untitled

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