$conn = new mysqli("localhost","root","password","dbname");
if(! $conn ) {
die('Could not connect to the database ');
}
$userEmail ="russel@example.com";
$updateData = "UPDATE users SET user_email ='$userEmail' WHERE username= 'russel'";
if (mysqli_query($conn, $updateData)) {
echo "Record updated successfully";
}
else {
echo "Error updating record: " . mysqli_error($conn);
}
Need a helping hand in fixing your website issues?
If you are facing any problems in implementing these code snippets and tutorials, you can hire us to fix your website issues.
Hire Us