假设我有一个数组:
$elements = array('foo', 'bar', 'tar', 'dar');
然后我想建立一个 DELETE IN
SQL查询:
$SQL = "DELETE FROM elements
WHERE id IN ('" . implode(',', $elements) . "')";
问题是在elements数组中的id并没有单独引用。IE查询看起来像:
$SQL = "DELETE FROM elements
WHERE id IN ('foo,bar,tar,dar');
解决此问题的最好,最优雅的方法是什么?