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  »  Sorting a field's values using a different column?

phpMyEdit General     Sorting a field's values using a different column?
Post new topic   Reply to topic    
 
futurity     Joined: 07 Jan 2009   Posts: 4  
Post Posted: 2009-01-07 13:13
Back to top  Reply with quote     

I'm using a simple table lookup, but although I've tried many different methods I can't work out how to sort using the id number rather than the looked up name.

I currently have a field "end_month" that contains an index to the id field in the months table:

$opts['fdd']['end_month'] = array(
'name' => 'End month',
'select' => 'T',
'maxlen' => 11,
'sort' => true
);

To display the month name rather than the id I use the following code:

$opts['fdd']['end_month']['values']['table'] = 'months';
$opts['fdd']['end_month']['values']['column'] = 'id';
$opts['fdd']['end_month']['values']['description'] = 'long_name'; // optional

However it sorts alphabetically on the month name, not on the id stored in the field. It make no difference if I set sort to false. The months and there iIDs are:

1, Jan
2, Feb
etc

But Apr (April) always appears first in the list.

Any help would be much appreciated,

Regards

Neil

 
doug     Joined: 10 Feb 2003   Posts: 1013   Location: Denver, Colorado (USA)
Post Posted: 2009-01-07 14:17
Back to top  Reply with quote     

See the 'orderby' option under "Complex table lookup example" at http://opensource.platon.sk/projects/doc.php/phpMyEdit/html/configuration.input-restrictions.html#AEN963

 
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