错误号:从数据库中选择时为 1064



>当从下面的数据库中选择图像时,显示错误,在我删除数据库中的记录后,它保持相同的数字(id(

这是错误

Error Number: 1064 
You have an error in your SQL syntax; check the manual that corresponds to your MySQL 
server version for the right syntax to use near '16,19,1,2,1,2,1 )' at line 1
select * from images where id in(,16,19,1,2,1,2,1 )
Filename: controllers/Admin.php
Line Number: 1046

这是选择语句:

if (!empty($data->images)) {
$qry = $this->db->query("select * from images where id in($data- 
>images )");
$res['results'] = $qry->result();
}

现在我的数据库是空的,这个错误仍然存在?

就像这样删除前导逗号。

select * from images where id in( 16,19,1,2,1,2,1 )

$data->images中有一个前导逗号

最新更新