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  »  use a table field value in sql statement of a virtual field

phpMyEdit General     use a table field value in sql statement of a virtual field
Odoslať novú tému   Odpovedať na tému    
 
kelljery     Založený: 30.05.2008   Príspevky: 2  
Príspevok Zaslal: 2008-05-30 23:06
Návrat hore  Odpovedať s citátom     

Hello,
I cannot manage to solve my problem, which is described below. Thanks in advance if someone can help me...

I would like to use the value of the "id" field in the sql statement of the virtual column, as follows :

$opts['fdd']['id'] = array(
'name' => 'id',
'select' => 'T',
'maxlen' => 15,
'required' => true,
);
$opts['fdd']['see_also'] = array(
'name' => 'see_also',
'select' => 'T',
'maxlen' => 35,
);
$opts['fdd']['virtual'] = array(
'name' => 'Present',
'input' => 'R',
'sql' => "(SELECT id FROM table WHERE see_also LIKE '%id%')",
);

the virtual column should display all value of id field where see_also has id in it.

To explain a bit better, the view should looks as follow:
rec1: id=ae see_also=ac virtual=ac
rec2: id=mp see_also=ac virtual=
rec3: id=ac see_also=ae virtual=ae mp

I hope someone has a solution...
Thanks and Best Regards,
Kelljery

 
Icehawg     Založený: 09.04.2008   Príspevky: 20  
Príspevok Zaslal: 2008-05-30 23:35
Návrat hore  Odpovedať s citátom     

Kód:
'sql' => '(SELECT id FROM table WHERE see_also LIKE PMEtable0.id)',


Should do the trick for you.

 
kelljery     Založený: 30.05.2008   Príspevky: 2  
Príspevok Zaslal: 2008-05-31 08:31
Návrat hore  Odpovedať s citátom     

thanks a lot Icehawg for your quick answer.
it works very well ... unfortunately only with one id.

for the sample view as follows
rec3: id=ac see_also=ae virtual=ae mp

there is 2 entrys in virtual column. in that case I get an error that request has more than 1 row.

maybe what i'm trying to do is not possible !?

Thanks if you have any suggestion.
Best regards,
Kelljery.

 
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