| verzia 1.35, 2003/12/15 14:32:22 |
verzia 1.36, 2003/12/18 20:36:01 |
|
|
| <!-- $Platon: phpMyEdit/doc/sgml/configuration.fields.sgml,v 1.34 2003/12/11 12:29:47 nepto Exp $ --> |
<!-- $Platon: phpMyEdit/doc/sgml/configuration.fields.sgml,v 1.35 2003/12/15 14:32:22 nepto Exp $ --> |
| |
|
| <!-- Categories: |
<!-- Categories: |
| |
|
| Riadok 777 $opts['fdd']['title']['sql'] = 'IF(TRIM( |
|
| Riadok 777 $opts['fdd']['title']['sql'] = 'IF(TRIM( |
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| First example appends content of <varname>firstname</> field to |
The first example appends content of the <varname>firstname</> field to the |
| <varname>surname</> field. Because this is done on the database level, sorting |
<varname>surname</> field. Because this is done on the database level, sorting |
| and searching (in table filtering page) on this field will properly work. |
and searching (in table filtering page) on this field will properly work. |
| Similarly in the second example, the <varname>title2</> field will be used if |
Similarly in the second example, the <varname>title2</> field will be used if |
| <varname>title</> field is empty. In this manner you can define some special |
the <varname>title</> field is empty. In this manner you can define a special |
| static string, which should be printed in case a field is empty. Just |
static string, which should be printed in case a field is empty. Just |
| substitute a quoted string in place of <varname>title2</>. |
substitute a quoted string in place of <varname>title2</>. |
| |
|
| Riadok 802 $opts['fdd']['title']['sqlw'] = 'TRIM("$ |
|
| Riadok 802 $opts['fdd']['title']['sqlw'] = 'TRIM("$ |
|
| |
|
| The first example above makes <varname>surname</> uppercase when storing field |
The first example above makes <varname>surname</> uppercase when storing field |
| into database. The second one trims all whitespace characters around |
into database. The second one trims all whitespace characters around |
| <varname>title</> before writting it to database. |
<varname>title</> before writing it to database. |
| |
|
| </para> |
</para> |
| <para> |
<para> |
| Riadok 813 As a placeholder for the field's content |
|
| Riadok 813 As a placeholder for the field's content |
|
| <member> <varname>$val</varname></member> |
<member> <varname>$val</varname></member> |
| <member> -- value of the field</member> |
<member> -- value of the field</member> |
| <member> <varname>$val_as</varname></member> |
<member> <varname>$val_as</varname></member> |
| <member> -- value with applied <function>addslashes()</function> function</member> |
<member> -- value with <function>addslashes()</function> function applied</member> |
| <member> <varname>$val_qas</varname></member> |
<member> <varname>$val_qas</varname></member> |
| <member> -- same as <varname>$val_as</varname> with quotes around</member> |
<member> -- same as <varname>$val_as</varname> with quotes around</member> |
| </simplelist> |
</simplelist> |
| Riadok 821 As a placeholder for the field's content |
|
| Riadok 821 As a placeholder for the field's content |
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| So if the <varname>$val</varname> is <constant>some"nice"thing</constant>, |
If the <varname>$val</varname> is <constant>some"nice"thing</constant>, then |
| than <varname>$val_as</varname> becomes <constant>some\"nice\"thing</constant> |
<varname>$val_as</varname> becomes <constant>some\"nice\"thing</constant> and |
| and <varname>$val_qas</varname> becomes |
<varname>$val_qas</varname> becomes <constant>"some\"nice\"thing"</constant>. |
| <constant>"some\"nice\"thing"</constant>. You have to use these variables |
You have to use these variables correctly in your <varname>['sqlw']</varname> |
| correctly in your <varname>['sqlw']</varname> expressions, otherwise MySQL |
expressions, otherwise a MySQL parsing error could occur. We recommend you use |
| parsing error could be occured. We recommend you to use |
the <varname>$val_qas</varname> variable whenever possible, as it is the |
| <varname>$val_qas</varname> variable whenewer possible, as it is the most safe |
safest one from the mentioned alternatives. |
| one from the mentioned alternatives. |
|
| |
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| Very useful and favourite usage of <varname>['sqlw']</varname> option is to |
A very useful and favourite usage of the <varname>['sqlw']</varname> option is |
| explicitly tell &name; to store <constant>NULL</constant> value instead of |
to explicitly tell &name; to store a <constant>NULL</constant> value instead |
| empty string for the particular column. Empty string and |
of an empty string for the particular column. Empty string and |
| <constant>NULL</constant> are two different values. Many people really does |
<constant>NULL</constant> are two different values. Many people really do not |
| not like empty strings in their tables, thus now they have possibility to |
like empty strings in their tables, thus now they have possibility to change |
| change them for <constant>NULL</constant> when user simply fills nothing into |
them to <constant>NULL</constant> when user simply enters nothing into form |
| form input field. |
input field. |
| |
|
| <example> |
<example> |
| <title>Storing <constant>NULL</constant> instead of empty string</title> |
<title>Storing <constant>NULL</constant> instead of empty string</title> |