->whereAdd() -- Add WHERE statement
Beschrijving
Adds items to the where part of a SQL query.
Calling this without any arguments clears the where condition.
The default behavior is to add 'AND' to the existing conditions,
use the $logic parameter to append OR conditions.
Parameter
string $cond
- condition to add, or blank to reset the conditions
string $logic
- optional logic "OR" (defaults to "AND")
Note
Deze functie kan niet statisch worden aangeroepen.
Voorbeeld
Voorbeeld 34-1. Using whereAdd() $person = new DataObjects_Person;
$person->whereAdd('age > 12');
$person->whereAdd('age < 30');
$person->find();
while ($person->fetch()) {
echo "$person->id} {$person->name}<BR>";
}
$person = new DataObjects_Person;
$person->whereAdd('age < 12');
$person->whereAdd('age > 30', 'OR');
$person->find();
while ($person->fetch()) {
echo "{$person->id} {$person->name}<BR>";
} |
|