PHP
·
发表于 5年以前
·
阅读量:8303
±¾ÎÄʵÀý½²Ê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¡£