CI¿ò¼ÜARÊý¾Ý¿â²Ù×÷³£Óú¯Êý×ܽá

5年以前  |  阅读数:405 次  |  编程语言:PHP 

±¾ÎÄʵÀý½²ÊoÁËCI¿o¼ÜARÊý¾Ý¿a²Ù×÷³£Óú¯Êý¡£*ÖÏi¸ø´o¼Ò¹(C)´o¼Ò²Î¿¼£¬¾ßÌaÈçÏ£º

1¡¢²eѯ±i¼Ç¼


    $this->db->select();  //Ñ¡Ôñ²eѯµÄ×Ö¶Î
    $this->db->select_max();
    $this->db->select_min();
    $this->db->select_avg();
    $this->db->select_sum();
    $this->db->from();   //Ñ¡Ôñ±iÃu
    $this->db->join();
    $this->db->get();   //µÃµ½²eѯ½a¹u
    $this->db->get_where();
    $this->db->where();
    $this->db->or_where();
    $this->db->where_in();
    $this->db->or_where_in();
    $this->db->where_not_in();
    $this->db->or_where_not_in();
    $this->db->like();
    $this->db->or_like();
    $this->db->not_like();
    $this->db->or_not_like();
    $this->db->group_by();
    $this->db->distinct();
    $this->db->having();
    $this->db->or_having();
    $this->db->order_by();
    $this->db->limit();
    $this->db->count_all_results();

2¡¢Ôo¼Ó±i¼Ç¼


    $this->db->insert();

3¡¢¸u¸Ä±i¼Ç¼


    $this->db->set();
    $this->db->update();

4¡¢É¾³ý±i¼Ç¼


    $this->db->delete();

5¡¢Ça¿Õ±i¼Ç¼


    $this->db->empty_table();
    $this->db->truncate();

*6¡¢»º´ae²¿Ö**


    $this->db->start_cache()
    $this->db->stop_cache()
    $this->db->flush_cache()

7¡¢½a¹u½a¹u¼¯


    result()  //*µ»Ø¶ÔÏoÊý×e
    result_array() //*µ»Ø¶þάÊý×e
    row()   //*µ»ØÒ»¸o¶ÔÏo
    row_array()  //*µ»ØһάÊý×e
    num_rows()  //*µ»Ø²eѯµÄÐÐÊý
    num_fields() //*µ»Ø²eѯ½a¹uµÄ×Ö¶ÎÊý
    free_result() //ÊÍ*ŲeѯËuÕ¼µÄ×ÊÔ´ÄÚ´ae

8¡¢¸¨Öu²eѯº¯Êý


    $this->db->insert_id()  //»ñÈ¡¸Õ¸Õ²aÈeµÄid
    $this->db->affected_rows() //Ð޸Ļo²aÈeÓ°ÏiµÄÐÐÊý
    $this->db->count_all();  //ͳ¼Æ¼Ç¼µÄ×ÜÌoÊý ÕaÒ»º¯Êý¼ÓÈewhereÌo¼þÎÞЧ
    $this->db->last_query();  //×iºoÒ»ÌoÖ´ÐеÄsqlÓi¾a
    //×¢ÒaÒÔÏÂÁ½¸oº¯Êý½o*µ»ØsqlÓi¾a ²»Ö´ÐÐsqlÓi¾a
    $data = array('name' => $name, 'email' => $email, 'url' => $url);
    $str = $this->db->insert_string('table_name', $data);
    $data = array('name' => $name, 'email' => $email, 'url' => $url);
    $where = "author_id = 1 AND status = 'active'";
    $str = $this->db->update_string('table_name', $data, $where); //*µ»ØÕýÈ*¸ñʽµÄ¸uÐÂ×Ö*u´®

PS£º¹ØÓÚCodeIgniterÏeϸʹÓü¼Çɿɲο¼±¾Õ¾ÔÚÏßÊÖ²a£º

CodeIgniter 2.2.4Óû§Ö¸ÄÏ£º
http://shouce.jb51.net/codeigniter2.2/

CodeIgniter 3.0Óû§Ö¸ÄÏ£º
http://shouce.jb51.net/codeigniter3.0/

¸u¶a¹ØÓÚCodeIgniterÏa¹ØÄÚÈݸÐÐËȤµÄ¶ÁÕ߿ɲe¿´±¾Õ¾×¨Ìa£º¡¶codeigniterÈeÃŽ̡̳¡¢¡¶CI(CodeIgniter)¿o¼Ü½ø½×½Ì³Ì¡¡¢¡¶phpÓÅÐa¿ª*¢¿o¼Ü×ܽa¡¡¢¡¶ThinkPHPÈeÃŽ̡̳¡¢¡¶ThinkPHP³£Óý¨×ܽa¡¡¢¡¶Zend FrameWork¿o¼ÜÈeÃŽ̡̳¡¢¡¶phpÃaeÏo¶ÔÏo³ÌÐoÉe¼ÆÈeÃŽ̡̳¡¢¡¶php+mysqlÊý¾Ý¿a²Ù×÷ÈeÃŽ̡̳¼°¡¶php³£¼uÊý¾Ý¿a²Ù×÷¼¼ÇÉ»a×Ü¡*

Ï£Íu±¾ÎÄËuÊo¶Ô´o¼Ò»uÓÚCodeIgniter¿o¼ÜµÄPHP³ÌÐoÉe¼ÆÓÐËu°iÖu¡£

 相关文章:
PHP分页显示制作详细讲解
SSH 登录失败:Host key verification failed
获取IMSI
将二进制数据转为16进制以便显示
获取IMEI
文件下载
贪吃蛇
双位运算符
PHP自定义函数获取搜索引擎来源关键字的方法
Java生成UUID
发送邮件
年的日历图
提取后缀名
在Zeus Web Server中安装PHP语言支持
让你成为最历害的git提交人
Yii2汉字转拼音类的实例代码
再谈PHP中单双引号的区别详解
指定应用ID以获取对应的应用名称
Python 2与Python 3版本和编码的对比
php封装的page分页类完整实例