求一个sql查询的问题 where 数组 的问题

浏览:3220 发布日期:2013/09/16 分类:求助交流
首先用的是 thinkphp

where($map)

查询条件的数组是这样的

$map['pass']="1";
$map['ems'] = '2';
$map['status']="sellout";

但 我想加个sql查询 where = " and (select count(c.item_id) from " . table("items_cate_re") ." as c where c.cate_id=$cid and c.item_id=" . table("items") . ".id)>0 ";

如果是普通的 $where =" pass = 1" 这的话
直接 $where .= " and (select count(c.item_id) from " . table("items_cate_re") ." as c where c.cate_id=$cid and c.item_id=" . table("items") . ".id)>0 ";
就好了

原sql 是这样的

$items_list = $item_mod->where($map)->order($order)->limit($start . ',' . $page_size)->select();

可是 数组 和字符串 混一起了 搞了半天 没搞出来 晕倒的

求指点迷津 谢谢
最佳答案
评论( 相关
后面还有条评论,点击查看>>