Summary of related usage of database operation function $this->db->where () in CI framework, this-db-
This paper summarizes the related usage of database operation function $this->db->where () in CI framework. Share to everyone for your reference, as follows:
The use of the CI Framework database operation function This->db->where ()
1) $this->db->where (' MATCH (field) against ("value") ', NULL, FALSE)
If you set $this->db->where () to accept the optional third argument to FALSE, CodeIgniter will not provide protection for those field names or table names that contain anti-tick numbers.
2) $this->db->or_where ()
This function is almost identical to the one above, the only difference being that the clauses generated by this function are connected with OR:
$this->db->where (' Name! = ', $name); $this->db->or_where (' ID > ', $id);//Generate: where name! = ' Joe ' or ID > 5 0
Description: Or_where () was formerly called Orwhere () and the latter was obsolete.
3) $this->db->where_in ();
Generate a WHERE field in (' Item ', ' item ') query statement, if appropriate, with and connected.
$names = Array (' Frank ', ' Todd ', ' James '), $this->db->where_in (' username ', $names);//Generate: Where Username in (' Frank ' , ' Todd ', ' James ')
4) $this->db->or_where_in ();
Generate a WHERE field in (' Item ', ' item ') query statement, if appropriate, with OR connected.
$names = Array (' Frank ', ' Todd ', ' James '), $this->db->or_where_in (' username ', $names);//Generate: Or username in (' Frank ' , ' Todd ', ' James ')
5) $this->db->where_not_in ();
Generate a WHERE field not in (' Item ', ' item ') query statement, if appropriate, connect with and.
$names = Array (' Frank ', ' Todd ', ' James '), $this->db->where_not_in (' username ', $names);//Generate: Where Username not in ( ' Frank ', ' Todd ', ' James ')
6) $this->db->or_where_not_in ();
Generate a WHERE field not in (' Item ', ' item ') query statement, if appropriate, with OR connected together.
$names = Array (' Frank ', ' Todd ', ' James '), $this->db->or_where_not_in (' username ', $names);//Generate: or Username not in ( ' Frank ', ' Todd ', ' James ')
More interested in CodeIgniter related content readers can view this site topic: "CodeIgniter Introductory Tutorial", "CI (codeigniter) Framework Advanced Tutorial", "PHP Excellent Development Framework Summary", "thinkphp Getting Started", " Summary of common methods of thinkphp, "Introduction to Zend Framework Frame", "Introduction to PHP Object-oriented Programming", "Introduction to Php+mysql Database Operation" and "PHP common database Operation Skills Summary"
It is hoped that this article is helpful to the PHP program design based on CodeIgniter framework.
http://www.bkjia.com/PHPjc/1127874.html www.bkjia.com true http://www.bkjia.com/PHPjc/1127874.html techarticle in the CI framework, the database operation function $this-db-where () Related usage Summary, this-db-This article summarizes the CI Framework database operation function $this-db-where () related usage. Share for the big ...