CDbCriteria is a class in the Yii PHP framework that is used to create and manipulate search criteria for database queries. One of the methods available in CDbCriteria is addBetweenCondition, which is used to add a SQL BETWEEN operator to the search criteria. This operator selects values within a specified range.
Here are some example code snippets using addBetweenCondition:
Example 1: Select all users with ages between 18 and 30.
$criteria = new CDbCriteria; $criteria->addBetweenCondition('age', 18, 30);
Example 2: Select all products with prices between $10 and $100.
$criteria = new CDbCriteria; $criteria->addBetweenCondition('price', 10, 100);
In both examples, a new instance of CDbCriteria is created, and then the addBetweenCondition method is used to add a condition to the search criteria. The method takes three arguments: the name of the column, the lower bound of the range, and the upper bound of the range.
The addBetweenCondition method is part of the Yii framework's database package.
PHP CDbCriteria::addBetweenCondition - 30 examples found. These are the top rated real world PHP examples of CDbCriteria::addBetweenCondition extracted from open source projects. You can rate examples to help us improve the quality of examples.