Created
July 12, 2014 09:54
-
-
Save kublaios/007ee6b7b7936c6cd80a to your computer and use it in GitHub Desktop.
PDO ON DUPLICATE KEY UPDATE for multiple insert rows
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
function test() { | |
$sql = "INSERT INTO `table` (`id`, `name`) VALUES (?,?),(?,?) ON DUPLICATE KEY UPDATE `name` = VALUES(`name`) "; | |
$values = array(1, "test", 2, "so so"); | |
$stmt = $this->db->prepare($sql); | |
$stmt->execute($values); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment