我正在尝试使用数组查询 MySQL 数据库。
$array=array('Group1','Group2','Group3');
$inQuery=implode(",",$array);
//$inQuery='Group1'; //This returns the expected result, but is obviously not an array
$data=array($inQuery);
try {
$STH = $this->DBH->prepare('SELECT GroupName FROM myTable WHERE GroupName IN(?)');
$STH->execute($data);
/* Output results*/
}
catch(PDOException $e) { /*Panic!*/ }
我没有收到任何错误消息,只有 0 个结果。任何帮助,将不胜感激!