| Index
» Projekty
» phpMyEdit
» Fórum
» Combining non-db fields into a db field |
 |
MG
Založený: 28.06.2006
Príspevky: 5
Zaslal: 2006-06-28 08:47
Návrat hore
Odpovedať s citátom
|
I have a database field that is a latitude. This is stored as 37.12 degrees. When a user edits it, they want to edit it as two fields: one for degrees (37 in the example) and another for minutes (7.20 minutes in the example).
Now, I've managed to create the degrees and minutes fields using the SQL syntax.
| Kód: |
$opts['fdd']['latdeg'] = array(
'name' => 'Lat Deg',
'sql' => 'FLOOR(lat)'
) ;
$opts['fdd']['latmin'] = array(
'name' => 'Lat Min',
'sql' => 'ROUND(MOD(-lat,1) * 60,2)'
) ; |
Now this gives me a problem. It seems to think that because these fields are editable (and they MUST be), then they must exist in the database.
I can use a trigger to set the correct value in the actual database field.
How do I tell it to ignore these fields for a database update?
Mike
|
michal
Založený: 17.06.2003
Príspevky: 537
Bydlisko: Slovakia
Zaslal: 2006-06-28 17:29
Návrat hore
Odpovedať s citátom
|
in trigger before unset($newvalsp['field']) the field you don't want. and edit $newvals['other'] to what you want.
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|