This paper summarizes the related usage of database operation function $this->db->where () in CI framework. Share to everyone for your reference, specific as follows:
The use of CI Framework database operation function This->db->where ()
1) $this->db->where (' MATCH (field) against (' value ') ', NULL, FALSE)
If the $this->db->where () accepts the optional third argument set to FALSE, CodeIgniter will not provide protection for the field or table names that contain the counter tick number.
2) $this->db->or_where ()
This function is almost identical to the one above, and the only difference is that the clause generated by this function is connected with OR:
$this->db->where (' name!= ', $name);
$this->db->or_where (' ID > ', $id);
Build: WHERE name!= ' Joe ' OR ID > 50
Description: Or_where () formerly known as Orwhere (), the latter is obsolete.
3) $this->db->where_in ();
Generates a WHERE field in (' Item ', ' item ') query statement, if appropriate, connected with and.
$names = Array (' Frank ', ' Todd ', ' James ');
$this->db->where_in (' username ', $names);
Build: WHERE username in (' Frank ', ' Todd ', ' James ')
4) $this->db->or_where_in ();
Generate a WHERE field in (' Item ', ' item ') query statement, if appropriate, connected with OR.
$names = Array (' Frank ', ' Todd ', ' James ');
$this->db->or_where_in (' username ', $names);
Generated: OR username in (' Frank ', ' Todd ', ' James ')
5) $this->db->where_not_in ();
Generates a WHERE field not in (' Item ', ' item ') query statement, if appropriate, connected with and.
$names = Array (' Frank ', ' Todd ', ' James ');
$this->db->where_not_in (' username ', $names);
Build: WHERE username not in (' Frank ', ' Todd ', ' James ')
6) $this->db->or_where_not_in ();
Generates a WHERE field not in (' Item ', ' item ') query statement, if appropriate, connected with OR.
$names = Array (' Frank ', ' Todd ', ' James ');
$this->db->or_where_not_in (' username ', $names);
Generated: OR username not in (' Frank ', ' Todd ', ' James ')
More interested in CodeIgniter related content readers can view the site topics: "CodeIgniter Introductory Course", "CI (CodeIgniter) Framework Advanced Course", "PHP Excellent Development Framework Summary", "thinkphp Introductory Course", " Thinkphp Common Methods Summary, "Zend Framework Introduction Course", "PHP object-oriented Programming Introduction Course", "Php+mysql Database operation Introduction Tutorial" and "PHP common database Operation Skills Summary"
I hope this article will help you with the PHP program design based on CodeIgniter framework.