我的代码是...
$select_product_dups = $db->prepare("SELECT products_model FROM products GROUP BY products_model HAVING count( products_model ) > 1");
我的编辑对我大吼大叫(至少用很少的信息突出显示),所以我想我会与社区核实一下。否则一切看起来都很好。
完整的声明...
$select_product_dups = $db->prepare("SELECT products_model FROM products GROUP BY products_model HAVING count( products_model ) > 1");
$select_product_dups->setFetchMode(PDO::FETCH_ASSOC);
$select_product_dups->execute();
while ($select_product_dups_row = $select_product_dups->fetch()){
$dups[] = $select_product_dups_row['products_model'];
}