Summary of related usage of database operation function $this->db->where () in CI Framework, this-db-_php tutorial

Source: Internet
Author: User
Tags codeigniter zend framework

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 ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.