CI 框架數據庫細節操做(會持續更新)

模糊查詢:sql

$this->db->like('title''match''before');
// 生成: WHERE title LIKE '%match'
// 生成: WHERE title LIKE 'match%'
$this->db->like('title''match''after');
// 生成: WHERE title LIKE '%match%'
$this->db->like('title''match''both');

排序:this

$this->db->order_by('sort', 'desc');

返回sql語句: echo $this->db->last_query();code

返回插入id:$this->db->insert_id();   排序

相關文章
相關標籤/搜索