


Summary of related usage of database operation function $this->db->where() in CI framework
The examples in this article summarize the related usage of the database operation function $this->db->where() in the CI framework. Share it with everyone for your reference, the details are as follows:
Usage of CI framework database operation function this->db->where()
1) $this->db-> ;where('MATCH (field) AGAINST ("value")', NULL, FALSE)
If $this->db->where() accepts the optional third parameter, set it to FALSE, CodeIgniter will not protect field or table names that contain backticks.
2) $this->db->or_where()
This function is almost identical to the one above. The only difference is that the clause generated by this function uses OR. Connected:
$this->db->where('name !=', $name); $this->db->or_where('id >', $id); // 生成: WHERE name != 'Joe' OR id > 50
Description: or_where() was previously called orwhere(), which is obsolete.
3) $this->db->where_in();
Generate a WHERE field IN ('item', 'item') query statement, and use AND if appropriate connect them.
$names = array('Frank', 'Todd', 'James'); $this->db->where_in('username', $names); // 生成: WHERE username IN ('Frank', 'Todd', 'James')
##4)$this->db->or_where_in();Generate a WHERE field IN ('item', 'item') query statements, concatenated with OR if appropriate.
$names = array('Frank', 'Todd', 'James'); $this->db->or_where_in('username', $names); // 生成: OR username IN ('Frank', 'Todd', 'James')
##5)$this->db->where_not_in();
Generate a WHERE field NOT IN ('item' , 'item') query statements, connected with AND if appropriate.
$names = array('Frank', 'Todd', 'James'); $this->db->where_not_in('username', $names); // 生成: WHERE username NOT IN ('Frank', 'Todd', 'James')
##6)$this->db->or_where_not_in();Generate a WHERE field NOT IN ('item' , 'item') query statements, connected with OR if appropriate.
$names = array('Frank', 'Todd', 'James'); $this->db->or_where_not_in('username', $names); // 生成: OR username NOT IN ('Frank', 'Todd', 'James')I hope this article will be helpful to everyone’s PHP program design based on the CodeIgniter framework. For more related usage summary of the database operation function $this->db->where() in the CI framework, please pay attention to the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Mac version
God-level code editing software (SublimeText3)

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Notepad++7.3.1
Easy-to-use and free code editor

WebStorm Mac version
Useful JavaScript development tools
