| verzia 1.34, 2003/12/11 12:29:47 |
verzia 1.35, 2003/12/15 14:32:22 |
|
|
| <!-- $Platon: phpMyEdit/doc/sgml/configuration.fields.sgml,v 1.33 2003/12/09 11:16:14 nepto Exp $ --> |
<!-- $Platon: phpMyEdit/doc/sgml/configuration.fields.sgml,v 1.34 2003/12/11 12:29:47 nepto Exp $ --> |
| |
|
| <!-- Categories: |
<!-- Categories: |
| |
|
| Riadok 800 $opts['fdd']['title']['sqlw'] = 'TRIM("$ |
|
| Riadok 800 $opts['fdd']['title']['sqlw'] = 'TRIM("$ |
|
| </para> |
</para> |
| <para> |
<para> |
| |
|
| |
The first example above makes <varname>surname</> uppercase when storing field |
| |
into database. The second one trims all whitespace characters around |
| |
<varname>title</> before writting it to database. |
| |
|
| |
</para> |
| |
<para> |
| |
|
| As a placeholder for the field's content, there are three variables available. |
As a placeholder for the field's content, there are three variables available. |
| |
|
| <simplelist type="horiz" columns="2"> |
<simplelist type="horiz" columns="2"> |
| Riadok 819 than <varname>$val_as</varname> becomes |
|
| Riadok 826 than <varname>$val_as</varname> becomes |
|
| and <varname>$val_qas</varname> becomes |
and <varname>$val_qas</varname> becomes |
| <constant>"some\"nice\"thing"</constant>. You have to use these variables |
<constant>"some\"nice\"thing"</constant>. You have to use these variables |
| correctly in your <varname>['sqlw']</varname> expressions, otherwise MySQL |
correctly in your <varname>['sqlw']</varname> expressions, otherwise MySQL |
| parsing error could be occured. |
parsing error could be occured. We recommend you to use |
| |
<varname>$val_qas</varname> variable whenewer possible, as it is the most safe |
| |
one from the mentioned alternatives. |
| |
|
| |
</para> |
| |
<para> |
| |
|
| |
Very useful and favourite usage of <varname>['sqlw']</varname> option is to |
| |
explicitly tell &name; to store <constant>NULL</constant> value instead of |
| |
empty string for the particular column. Empty string and |
| |
<constant>NULL</constant> are two different values. Many people really does |
| |
not like empty strings in their tables, thus now they have possibility to |
| |
change them for <constant>NULL</constant> when user simply fills nothing into |
| |
form input field. |
| |
|
| |
<example> |
| |
<title>Storing <constant>NULL</constant> instead of empty string</title> |
| |
<programlisting><![CDATA[ |
| |
$opts['fdd']['col_name']['sqlw'] = 'IF($val_qas = "", NULL, $val_qas)' |
| |
]]></programlisting> |
| |
</example> |
| |
|
| </para> |
</para> |
| </sect1> |
</sect1> |