Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Wednesday, November 11, 2026
About Us
Magazine
Open Source
CVS
Services
Index  »  Projects  »  phpMyEdit  »  Forum  »  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
Post new topic   Reply to topic    
 
kelljery     Joined: 30 May 2008   Posts: 2  
Post Posted: 2008-05-30 23:06
Back to top  Reply with quote     

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     Joined: 09 Apr 2008   Posts: 20  
Post Posted: 2008-05-30 23:35
Back to top  Reply with quote     

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


Should do the trick for you.

 
kelljery     Joined: 30 May 2008   Posts: 2  
Post Posted: 2008-05-31 08:31
Back to top  Reply with quote     

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.

 
Post new topic   Reply to topic    

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Application form
Report bug on PLATON.SK website · Terms of use · Privacy policy