- $WHERE: Sql WHERE statement to select data conditionally (DO NOT include WHERE keyword).
The query filter is essentially the WHERE clause without the WHERE. The method adds WHERE condition an existing Sql SELECT statement. Use this method if you have WHERE clause in your SQL statement. You should use the same SQL syntax, such as single quotes around non-numeric values, and even SQL functions.
- NEVER include keyword “WHERE” the filter. phpGrid automatically adds WHERE to the query.
- Use only SINGLE QUOTE around the filtered value.
- When using table alias, also include the new table alias
$dg -> set_query_filter("status='Shipped' AND YEAR(shippedDate) = 2003");
Using Table Alias
When using table alias, please also include the table alias as part of the filter. Otherwise, the full table name is automatically inserted as part of the query which would throw “Unknown column in ‘where clause” error.
$dg -> set_query_filter("T.mycolumn = 'foo' ");