Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Pondelok, 30. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Combining non-db fields into a db field

phpMyEdit Configuration     Combining non-db fields into a db field
Odoslať novú tému   Odpovedať na tému    
 
MG     Založený: 28.06.2006   Príspevky: 5  
Príspevok 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
Príspevok 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    

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