zoukankan      html  css  js  c++  java
  • ci的一些数据库操作

    简单操作:

    insert('table', array)
    get('table',)
    get_where('table', array, $limit, $offset)->result()/result_array()
    update('table', array, 'id = xx')
    $this->db->where('id', $id)->delete('table')
    $this->db->delete('table', array);
    $this->db->where(array)->count_all_result('table');
    $this->db->count_all('table')
    $this->db->order_by('times', 'DESC')->get('table', $num, ($page-1)*$num)->result();
    
    查询:
    $this->db->query(sqlstring,array绑定参数)->result()/result_array()
    $this->db->query(sqlstring)->row()/row_array()/num_rows()
    插入
    $this->db->query(sqlstring)
    查询构造器
    $this->db->get('table', 10, 20)->result()/result_array() // limit 20, 10
    $this->db->insert('table', array);
    错误
    $this->db->error()
    查询辅助函数
    $this->db->insert_id()/count_all()/insert_string('table',array)/update_string()
    其他
    $this->db->select()/select_max(),$this->db->get('table')
    $this->db->select()/distinct()/from()/join('comments', 'comments.id=blogs.id')/where()/like()/group_by()/having()/order_by()/limit()/count_all_results()/count_all()/insert()/replace()/set()/update()/empty_table()/truncate()
  • 相关阅读:
    电脑技巧1
    web前端学习网站汇总1
    11月20日学习日志
    11月16日学习日志
    11月18日学习日志
    11月13日学习日志
    11月12日学习日志
    11月17日学习日志
    11月15日学习日志
    11月11日学习日志
  • 原文地址:https://www.cnblogs.com/maoriaty/p/9429306.html
Copyright © 2011-2022 走看看