CodeIgniter 数据库操作 -- 增删改查

    技术2022-05-19  18

    1、获取一个表的全部数据

    $this->db->get('mytable');

    // Produces: SELECT * FROM mytable

     

    第二和第三个参数允许你设置一个结果集每页纪录数(limit)和结果集的偏移(offset)

     

    $query = $this->db->get('mytable', 10, 20); // Produces: SELECT * FROM mytable LIMIT 20, 10

     

     

    设置要查询的字段

    $this->db->select('title, content, date'); $query = $this->db->get('mytable'); // Produces: SELECT title, content, date FROM mytable


    最新回复(0)