Advertisement
ridyko

Buat file update_process.php untuk memproses pembaruan data.

Jul 29th, 2024
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.36 KB | None | 0 0
  1. <?php
  2. include 'db.php';
  3.  
  4. $id = $_POST['id'];
  5. $name = $_POST['name'];
  6. $email = $_POST['email'];
  7.  
  8. $sql = "UPDATE users SET name='$name', email='$email' WHERE id=$id";
  9.  
  10. if ($conn->query($sql) === TRUE) {
  11.     echo "Record updated successfully";
  12. } else {
  13.     echo "Error updating record: " . $conn->error;
  14. }
  15.  
  16. $conn->close();
  17. header("Location: index.php");
  18. ?>
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement