mysql中in_array问题

t8000 2015-03-03 05:18:36
一个表叫 table,里面有
id type content isdel
1 1 dsafds 0
2 3 dflkj 0
3 4 dsafds 1
4 2 dflkj 1
.. 更多数据

$arraylist = '1,2,4,5';

需求想显示出 table 中 type 在 $arraylist 中,并且isdel = 0的内容

select * from table where isdel=0 and type in '{$arraylist}'

无效果,请问具体是什么?
...全文
493 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
一起混吧 2015-03-04
  • 打赏
  • 举报
回复
$sql = "select * from table where isdel=0 and type in '({$arraylist})'";
ACMAIN_CHM 2015-03-03
  • 打赏
  • 举报
回复
先在程序代码中检查生成的SQL语句到底是什么。

56,677

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧