ci中DB有个count_all方法
这个方法可以设置 where 条件嘛我今天自己写了个count方法:第一个参 为表名, 第二个参数为 where 语句。
呵呵 CI框架很强大,大家多交流哈 只有 $this->db->count_all_results(); 可以加条件,也就是 AR 里的方法才可以加条件。
请仔细看手册。 $this->db->like('title', 'match');
$this->db->from('my_table');
echo $this->db->count_all_results(); 可不可以在view中用num_row来赋值? $config['total_rows'] = $this->MStudent->serchStudents($_POST)->num_rows(); 我是先get_where来获得需要的行数,再用num_rows()取得需要的结果,这样能实现,不过效率上可能会低了一点
页:
[1]