zoukankan      html  css  js  c++  java
  • codeigniter 操作mysql的PHP代码--更新

    支持标准前缀

    1)查询没有平等,有平等的

    $this->db->get_where('host',array('host'=>'ddd','id !='=>0))->row();


    2)2表相交

            return $this->db
                ->select('f.*,count(s.id) as subtotal')
                ->from('category as f')->join('category s', 'f.id=s.upid', 'left')
                ->where('f.upid', $upid)
                ->group_by('f.id')
                ->order_by('f.sort', 'asc')
                ->get()->result();

    3)多个order_by 排序

            return $this->db->select('*')
                ->from('v_category')
                ->where('upid',$upid)
                ->order_by('sort','asc')
                ->order_by('id','desc')
                ->get()->result();

    4)单条记录

            return $this->db->get_where('category', array('id' => $id))->row();
    


    5)多条记录

           return $this->db->get_where('v_category', array('upid' => $upid))->result();
    


    6)统计个数

           $this->db->where('host',$host)->where('id !=',$id)->from('host')->count_all_results();
    


    很多其它稍后补充,转载请注明来自 default7#zbphp.com,欢迎交流。


    版权声明:本文博主原创文章。博客,未经同意不得转载。

  • 相关阅读:
    Tomcat 调优的技巧
    双亲委派模型
    字典树实现
    Python获取房价信息和导出EXCEL
    日志检索关键字并截取上下行关联内容
    GC日志分析
    Linux 查看 删除进程
    Rotate partitions in DB2 on z
    C++ STL string
    DB2 for z: system catalog tables
  • 原文地址:https://www.cnblogs.com/mengfanrong/p/4881485.html
Copyright © 2011-2022 走看看