Code has been added to clipboard!
PHP MySQL Update for Procedural Connection
Example
<?php
$server = 'host';
$user = 'user';
$pass = 'pass';
$db = 'db';
// Create connection
$conn = mysqli_connect($server, $user, $pass, $db);
// Check connection
if (!$conn)Â {
die("Could not connect: " . mysqli_connect_error());
}
$sql = "UPDATE users SET username='john.doe' WHERE user_id=2";
if (mysqli_query($conn, $sql)) {
echo "Update successful.";
} else {
echo "Could not update: " . mysqli_error($conn);
}
mysqli_close($conn);
?>