Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Streda, 27. júl 2016
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Dokumentácia  »  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
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov