Created
May 12, 2016 14:33
-
-
Save wallacesilva/1140551047bced8ec7c426d767d869a8 to your computer and use it in GitHub Desktop.
Example using PDO PHP - bindParam - Reference to variables
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 | |
$stmt = $dbh->prepare("INSERT INTO REGISTRY (name, value) VALUES (?, ?)"); | |
$stmt->bindParam(1, $name); | |
$stmt->bindParam(2, $value); | |
// insert one row | |
$name = 'one'; | |
$value = 1; | |
$stmt->execute(); | |
// insert another row with different values | |
$name = 'two'; | |
$value = 2; | |
$stmt->execute(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment