Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Nedeľa, 29. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Integer field gets sorted as a string

phpMyEdit Configuration     Integer field gets sorted as a string
Odoslať novú tému   Odpovedať na tému    
 
rutetuti     Založený: 23.04.2009   Príspevky: 1  
Príspevok Zaslal: 2009-04-27 20:53
Návrat hore  Odpovedať s citátom     

Hi,

I have a "price" field that is defined below,
$opts['fdd']['price'] = array(
'name' => 'Price £;',
'select' => 'N',
'maxlen' => 10,
'sort' => true
);
When I run a query this sorts perfectly. However, I wanted to add the thousand separator and also a GB pound symbol, but if I add the following then the field gets sorted as a string so that, for instance, £100,000 is listed as less than £50,000.

$opts['fdd']['price']['sql|LF'] =
'if(price <> "0.00", CONCAT("&pound;", FORMAT(price, 0)), price)';

any ideas how I can keep my GB pound symbol and separator but have it sort as an integer?

thanks

 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2009-04-29 14:28
Návrat hore  Odpovedať s citátom     

I wonder if it would function differently if phpMyEdit's number_format option were used, instead of MySQL's FORMAT.

Kód:
$opts['fdd']['price']['number_format'] = array(2, '.', ',');


Also, is the desired sort available if the pound sign appears after the price? Perhaps you could use a dummy / virtual field to display the pound sign.

 
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