ArtiGrid
Where Condition
The where() method allows you to apply filtering conditions to your data query in a flexible way.
It supports multiple comparison operators and logical conditions, making it easy to build dynamic queries.
Supported conditions:
- Basic comparisons: =, !=, <>, >, <, >=, <=
- LIKE operator: for partial text matching
- IN operator: pass an array of values (e.g. [1,2,3])
- Logical operators: AND / OR between conditions
You can chain multiple where() calls to create more complex filters. For convenience, the whereLike() method is also available for quick LIKE queries.
Example: Filtering records where
paymentId is in a specific list.
<?php
$grid = new ArtiGrid();
$grid->table('payments')
->template('bootstrap5')
->where("paymentId", "IN", [11])
->required(false);
echo $grid->render();
?>
Fatal error: Uncaught TypeError: ArtiGrid::where(): Argument #3 ($value) must be of type string, array given, called in /home/develop1/public_html/artigrid.developmentserver.cl/pages/where.php on line 51 and defined in /home/develop1/public_html/artigrid.developmentserver.cl/artigrid/ArtiGrid.php:768 Stack trace: #0 /home/develop1/public_html/artigrid.developmentserver.cl/pages/where.php(51): ArtiGrid->where('paymentId', 'IN', Array) #1 {main} thrown in /home/develop1/public_html/artigrid.developmentserver.cl/artigrid/ArtiGrid.php on line 768