Skip to content

Instantly share code, notes, and snippets.

@felixpenrose
Created March 15, 2018 17:01
Show Gist options
  • Save felixpenrose/b46d7ab26c8af5f0a2f18f63dd79cc15 to your computer and use it in GitHub Desktop.
Save felixpenrose/b46d7ab26c8af5f0a2f18f63dd79cc15 to your computer and use it in GitHub Desktop.
<?php
$arr = [1,2,3];
$in = str_repeat('?,', count($arr) - 1) . '?';
$sql = "SELECT * FROM table WHERE column IN ($in)";
$stm = $db->prepare($sql);
$stm->execute($arr);
$data = $stm->fetchAll();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment