Created
September 12, 2021 11:21
-
-
Save ab-budaev/08af8e952baf7d61a6720dbdb06cbeb1 to your computer and use it in GitHub Desktop.
Simple gift to share it in the presentation about PDO and DB patterns
This file contains hidden or 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 | |
$connection = new PDO("mysql:host=$host;dbname=$dbname", $user, $password); | |
$statement = $connection->prepare("INSERT INTO table (col1, col2, col3) VALUES (?, ?, ?)"); | |
$statement->bindParam(1, "value1"); | |
$statement->bindParam(2, "value2"); | |
$statement->bindParam(3, "value3"); | |
// OR | |
$statement->execute("value1", "value2", "value3"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment