Code has been added to clipboard!
Updating Data With PHP MySQL
Example
<?php
$server = 'host';
$user = 'user';
$pass = 'pass';
$db = 'db';
// Create connection
$conn = new mysqli($host, $user, $pass, $db);
// Check connection
if ($conn->connect_error)Â {
 die("Could not connect: " . $conn->connect_error);
}
$sql = "UPDATE users SET username='john.doe' WHERE user_id=2";
if ($conn->query($sql) === TRUE) {
echo "Update successful.";
} else {
echo "Could not update: " . $conn->error;
}
$conn->close();
?>