Home  >  Article  >  php教程  >  CodeIgniter 数据库操作 -- 增删改查

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

WBOY
WBOYOriginal
2016-06-06 20:00:45882browse

1、获取一个表的全部数据 $this-db-get('mytable'); // Produces: SELECT * FROM mytable 第二和第三个参数允许你设置一个结果集每页纪录数(limit)和结果集的偏移(offset) $query = $this-db-get('mytable', 10, 20); // Produces: SELECT * FROM mytable LI

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:软件MD5Next article:jquery tmpl 模板