Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Friday, April 19, 2024
About Us
Magazine
Open Source
CVS
Services
Index  »  Projects  »  phpMyEdit  »  Documentation  »  HTML  »  Filters

3.7. Filters

Table-level filter capability (if set) is included in the WHERE clause of any generated SELECT statement. This gives you ability to work with a subset of data from table.

Example 3-20. Filter examples

$opts['filters'] = 'column1 like "%11%" AND column2 < 17';

$opts['filters'] = 'section_id = 9';

$opts['filters'] = 'PMEtable0.sessions_count > 200';

You can also pass an array to this option. If you do so, than array items are put together with "AND" SQL statement.

When generating a query, phpMyEdit redefines/aliases the table names for easy accessing of particular table fields in the main table and in the tables used in JOIN clauses as well. The main table name is changed to PMEtable0, tables used in JOIN clauses have their name like PMEjoinN where N is JOIN table order.

We recommend that you look at the generated SQL queries in your MySQL log file in order to know how database the table was aliased. Finally, the described approach is needed only if you are accessing a field name which occurs in more than one table of SQL query (thus MySQL cannot exactly determine what is meant by "field_name").

For future development is planned an initialization like the following one.

$opts['filters'] = array(
	'col_name_1' => 'value_1',
	'col_name_2' => 'value_2'
);
The main advantage of this approach will be that col_name_1 and col_name_2 fields are automatically considered as read-only on display record pages with pre-set value_1, value_2 and without the need to enter them manually.


Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Application form
Report bug on PLATON.SK website · Terms of use · Privacy policy