php?数据库查询
程序员文章站
2022-04-30 23:11:01
...
$id=array(23,24); $sql =" select `series_title` FROM ca_series where id in $id";//我想查id在23,24里的内容echo $sql;输出的效果:select `series_title` FROM ca_series where id in Array想要的效果:select `series_title` FROM ca_series where id in (23,24);
回复讨论(解决方案)
你只是查的整个数组吧,并没有具体数组里的某个值。
$id = array(23,24);
$in = join(',', $id);
$sql = "select `series_title` FROM ca_series where id in ( $in)";