In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article shows you how to CI framework AR database operation common functions, the content is concise and easy to understand, absolutely can make your eyes bright, through the detailed introduction of this article hope you can get something.
1. Query table records
$this- > db- > select (); / / Select query fields $this- > db- > select_max (); $this- > db- > select_min (); $this- > db- > select_avg (); $this- > db- > select_sum (); $this- > db- > from (); / Select table name $this- > db- > join (); $this- > db- > get (); / / get query results $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. Add table records
$this- > db- > insert ()
3. Change the table record
$this- > db- > set (); $this- > db- > update ()
4. Delete table records
$this- > db- > delete ()
5. Clear the table record
$this- > db- > empty_table (); $this- > db- > truncate ()
6. Cache part
$this- > db- > start_cache () $this- > db- > stop_cache () $this- > db- > flush_cache ()
7. Result set
Result () / return object array result_array () / return two-dimensional array row () / return an object row_array () / return one-dimensional array num_rows () / / return rows of query num_fields () / / number of fields that return query results free_result () / / release the resource memory occupied by the query
8. Auxiliary query function
$this- > db- > insert_id () / / get the number of rows just inserted id$this- > db- > affected_rows () / / the number of rows affected by modification or insertion $this- > db- > count_all (); / / the total number of records added to the function where invalid $this- > db- > last_query () / / the last executed sql statement / / Note that the following two functions only return the sql statement and do not execute the sql statement $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); / / returns the update string in the correct format
PS: for detailed tips on the use of CodeIgniter, please refer to the online manual of this site:
CodeIgniter 2.2.4 user Guide:
Http://shouce.jb51.net/codeigniter2.2/
CodeIgniter 3.0 user Guide:
Http://shouce.jb51.net/codeigniter3.0/
The above content is how to CI framework AR database operation common functions, have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.