Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Streda, 25. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Adding arbitrary fields not in DB

phpMyEdit General     Adding arbitrary fields not in DB
Odoslať novú tému   Odpovedať na tému    
 
plemieux     Založený: 11.05.2005   Príspevky: 20  
Príspevok Zaslal: 2005-09-07 19:10
Návrat hore  Odpovedať s citátom     

Is it possible to add arbitrary field troughout the form that are not part of the database?

What I would like to do is add a checkbox or yes/no select as a flag to apply special triggers. For example, this would allow me to delete uploaded files.

 
michal     Založený: 17.06.2003   Príspevky: 537   Bydlisko: Slovakia
Príspevok Zaslal: 2005-09-08 09:45
Návrat hore  Odpovedať s citátom     

yes,
just create a normal 'column' in pme config, giving it 'AC' flags and create a trigger insert before which will delete $newvals['column'] (cvs version needed)

 
plemieux     Založený: 11.05.2005   Príspevky: 20  
Príspevok Zaslal: 2005-09-08 13:35
Návrat hore  Odpovedať s citátom     

My field is set this way:

Kód:
$opts['fdd']['delete'] = array(
  'name'     => 'Delete?',
  'select'   => 'T',
  'options'  => 'AC',
  'maxlen'   => 1,
  'sort'     => false
);


and I have put this code in my insert before trigger:

Kód:
unset($newvals['delete']);


But that doesn't work. What am I doing wrong?

 
michal     Založený: 17.06.2003   Príspevky: 537   Bydlisko: Slovakia
Príspevok Zaslal: 2005-09-08 14:29
Návrat hore  Odpovedať s citátom     

you need cvs version of pme

not working means mysql gives error ? or compile error ?

 
ajh     Založený: 17.12.2003   Príspevky: 236  
Príspevok Zaslal: 2005-09-08 14:42
Návrat hore  Odpovedať s citátom     

Question...the CVS version of PME has a 'virtual' field type (['input'] = 'V'). Would this do the job as from what I can see it doesn't get written to the database as it's not a real field. It's not documented anywhere, so I wondered if it actually worked.

If it did, then you could define a virtual field, I think that you do need to define an 'sql' option for it, but that could be very basic (such as ' ').

 
plemieux     Založený: 11.05.2005   Príspevky: 20  
Príspevok Zaslal: 2005-09-08 14:53
Návrat hore  Odpovedať s citátom     

I use the CVS version (1.167).

The error come on the list page clearly because PME try to lookup the field in the DB. Error message is:

Kód:
MySQL error 1054
Unknown column 'PMEtable0.delete' in 'field list'


If a virtual field (V) is the way to go, can you provide sample code.

 
plemieux     Založený: 11.05.2005   Príspevky: 20  
Príspevok Zaslal: 2005-09-08 18:41
Návrat hore  Odpovedať s citátom     

Setting the field to virtual V with an empty SQL doesn't work.

Kód:
$opts['fdd']['delete'] = array(
  'name'     => 'Delete?',
  'select'   => 'V',
  'options'  => 'AC',
  'maxlen'   => 1,
  'sort'     => false,
  'sql'      => ''
);


It return an SQL syntax error.

 
ajh     Založený: 17.12.2003   Príspevky: 236  
Príspevok Zaslal: 2005-09-09 08:02
Návrat hore  Odpovedať s citátom     

Firstly it's the 'display' option that needs to be set to 'V'. For the 'sql' option, I suggest that you set it to something like '1'

 
pvargas     Založený: 03.10.2005   Príspevky: 1  
Príspevok Zaslal: 2005-10-03 15:23
Návrat hore  Odpovedať s citátom     

plemieux Napísal:
Setting the field to virtual V with an empty SQL doesn't work.

Kód:
$opts['fdd']['delete'] = array(
  'name'     => 'Delete?',
  'select'   => 'V',
  'options'  => 'AC',
  'maxlen'   => 1,
  'sort'     => false,
  'sql'      => ''
);


It return an SQL syntax error.


you can test this

$opts['fdd']['virtual_01'] = array(
'name' => ' ',
'select' => 'V',
'options' => 'L', // Only list
'maxlen' => 1,
'sort' => false,
'sql' => 'now()',
'display' => 'V',
'URLdisp' => "Text",
'URL' => 'link_to.php?ID=$key',
'URLtarget'=> '_self',
)

 
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