Last active
May 16, 2018 16:56
-
-
Save rob1121/4a57a81ad3408ccf11643e0c6bcf88d7 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
// good for insert query | |
//connect to db | |
$name = 'Rob'; | |
$message = 'Test'; | |
$sql = "INSERT INTO guestBook (name, message, posted) VALUES(?, ?, NOW())"; | |
$query = $handler->prepare($sql); | |
$query->execute([$name, $message]); | |
//echo last insrted id | |
echo $handler->lastInsertedId(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment