0

Need to remove a lot of records. It works:

$db->exec("DELETE from link WHERE link_id IN (35, 40, 50)");  
$ercode=$db->errorCode();

How can I get the number from the string or array? It code removes only the first number (19)

$string = "19, 20";
$count=$db->prepare("delete from link where item=:myid");
$count->bindParam(":myid", $string, PDO::PARAM_INT);
$count->execute();
user3798618
  • 758
  • 1
  • 7
  • 12
  • Plain PDO cannot bind arrays. You'll have to use a wrapper or reinvent your own utility code to insert a list of `?` placeholders and bind individual array entries. – mario Jul 17 '14 at 14:07
  • If that syntax was allowed, how could MySQL decide whether you want `'19', '20'` or `'19, 20'`? – Álvaro González Jul 17 '14 at 14:11

0 Answers0