Re: [PHP] sorting troubles

2006-04-25 Thread Richard Lynch
On Sat, April 22, 2006 4:49 am, William Stokes wrote: I have a column in DB that contains this kind of data, A20,B16,B17C14,C15,D13,D12 etc. I would like to print this data to a page and sort it ascending by the letter an descending by the number. Can this be done? Like A20 B17 B16 C15

Re: [PHP] sorting troubles

2006-04-25 Thread William Stokes
Thanks for your input everyone! The easiest way to do this was ansding this to the SELECT clause: select col from DB order by substring(col, 1, 1) ASC, substring(col, 2) DESC Seems to work fine. -Will Richard Lynch [EMAIL PROTECTED] kirjoitti viestissä:[EMAIL PROTECTED] On Sat, April 22,

Re: [PHP] sorting troubles

2006-04-24 Thread Philip Thompson
On Apr 22, 2006, at 4:49 AM, William Stokes wrote: Hello, Any idea how to sort this? I have a column in DB that contains this kind of data, A20,B16,B17C14,C15,D13,D12 etc. I would like to print this data to a page and sort it ascending by the letter an descending by the number. Can this be

Re: [PHP] sorting troubles

2006-04-24 Thread Philip Thompson
On Apr 24, 2006, at 9:06 AM, Philip Thompson wrote: On Apr 22, 2006, at 4:49 AM, William Stokes wrote: Hello, Any idea how to sort this? I have a column in DB that contains this kind of data, A20,B16,B17C14,C15,D13,D12 etc. I would like to print this data to a page and sort it ascending by

Re: [PHP] sorting troubles

2006-04-23 Thread chris smith
I have a column in DB that contains this kind of data, A20,B16,B17C14,C15,D13,D12 etc. I would like to print this data to a page and sort it ascending by the letter an descending by the number. Can this be done? Like A20 B17 B16 C15 C14 D13 D12 Depending on how many records you have

Re: [PHP] sorting troubles

2006-04-23 Thread David Tulloh
William Stokes wrote: Hello, Any idea how to sort this? I have a column in DB that contains this kind of data, A20,B16,B17C14,C15,D13,D12 etc. I would like to print this data to a page and sort it ascending by the letter an descending by the number. Can this be done? PHP has the

Re: [PHP] sorting troubles

2006-04-22 Thread Peter Hoskin
See explode, http://www.php.net/explode $var = 'A20,B16,B17C14,C15,D13,D12'; $array = explode(',',$var); foreach ($array as $key = $value) { echo $value .\n; } William Stokes wrote: Hello, Any idea how to sort this? I have a column in DB that contains this kind of data,

Re: [PHP] sorting troubles

2006-04-22 Thread Peter Hoskin
hmm, should also see http://www.php.net/sort Peter Hoskin wrote: See explode, http://www.php.net/explode $var = 'A20,B16,B17C14,C15,D13,D12'; $array = explode(',',$var); foreach ($array as $key = $value) { echo $value .\n; } William Stokes wrote: Hello, Any idea how to sort

Re: [PHP] sorting troubles

2006-04-22 Thread Paul Novitski
At 02:49 AM 4/22/2006, William Stokes wrote: I have a column in DB that contains this kind of data, A20,B16,B17C14,C15,D13,D12 etc. I would like to print this data to a page and sort it ascending by the letter an descending by the number. Can this be done? Like A20 B17 B16 C15 C14 D13 D12

Re: [PHP] sorting troubles

2006-04-22 Thread Paul Novitski
At 03:43 AM 4/22/2006, I wrote: Then just do a reverse sort on $aTemp and you get: Z20 Y17 Y16 Then translate the letters back to their original values and you get: A20 B17 C16 Oops, I made a typo: that final value should have been B16, not