zoukankan      html  css  js  c++  java
  • codeigniter 使用

    CodeIgniter系列 记录count和分页

    对于某个表的不带条件的count,可以简单的用

    $total = $this->db->count_all($table_name)

    来获取,但是如果有条件,则要用count_all_results

    $this->db->where('sex', 'M');

    $this->db->from('user');

    $total = $this->db->count_all_results();

    CI的pagination库可以帮助添加分页链接,用法可以看user_guide/libraries/pagination.html

    有几点需要说明。

    base_url里边如果有超过2个uri_segments,则需要设置$config['uri_segment'] = base_url_segments + 1

    也就是uri_segment默认是3。如果不设置的话,第一页和前一页,后一页的链接都不正确。

    文章标签: user urltable 
    生成url 地址:echo site_url('home/index');
    一个模板包含另一个目录中的模板文件:

    <!-- 引入头部公共文件 -->
    <?php $this->load->view('Common/m_header') ?>

  • 相关阅读:
    uva-11361
    HDU
    LCS
    CodeForces
    linux 有趣的命令组合
    opencv识别封闭区域 并标记该区域
    宜出行人口热力图
    美团酒店
    赶集租房
    发送企业微信应用通知
  • 原文地址:https://www.cnblogs.com/andydao/p/9282173.html
Copyright © 2011-2022 走看看