数据库操作 where 条件问题
表里一个字段是int型,名字叫score。我要查询的结果是这个score 在两个数字之间的结果,比如60到80之间。我是这样写的。
$this->db->where('score >',60);
$this->db->where('score <',80);
或者是这样
$this->db->where('score >',60);
$this->db->orwhere('score <',80);
都不行。我想用$this->db->where_in(),可是手册上说的好像在这中情况下没法用。
谁能告诉我怎么写才对啊? 非常感谢!
[ 本帖最后由 lindao310 于 2008-7-29 22:27 编辑 ] $this->db->where('score >',60);
$this->db->where('score <',80);
这相当于 where score>60 and score<80 为什么不行?你还有其他条件吧? 试试
$this->db->where('score > 60');
$this->db->where('score < 80');
实在不行写sql语句,用$this->db->query() 执行
问题解决了
是还有其他的条件,我把他们顺序换一下取出来的结果就对了。谢谢上面两位的回答。 mark标记 以后有用处。 用query嘛
页:
[1]