Created
December 28, 2020 03:27
-
-
Save barmgeat/f445c49ec5d2fc31bf3a66248e085808 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$servername = "localhost"; | |
$username = "username"; | |
$password = "password"; | |
$dbname = "myDB"; | |
// Create connection | |
$conn = new mysqli($servername, $username, $password, $dbname); | |
// Check connection | |
if ($conn->connect_error) { | |
die("Connection failed: " . $conn->connect_error); | |
} | |
$sql = "UPDATE MyGuests SET lastname='Doe' WHERE id=2"; | |
if ($conn->query($sql) === TRUE) { | |
echo "Record updated successfully"; | |
} else { | |
echo "Error updating record: " . $conn->error; | |
} | |
$conn->close(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment