The Update operation in CRUD is used to modify existing records in a MySQL database using PHP with MySQLi or PDO.
// SQL UPDATE syntax
UPDATE table_name
SET column='value'
WHERE condition;
// Update user email using PHP MySQLi
<?php
$conn=new mysqli("localhost","username","password","myDB");
if($conn->connect_error){
die("Connection failed");
}
$sql="UPDATE users SET email='john.doe@newdomain.com' WHERE id=1";
$conn->query($sql);
$conn->close();
?>
Updates the selected user record and confirms the update if successful.