I need to sort the following array:
{
[Smith, Bob]=array(137.5,125.5),
[Jones, Robert]=array(132.7,128.2)
}
The array needs to be sorted by the first number (i.e. 137.5) and then the
second in descending order. I looked at array_multisort but couldn't figure
out how to make
-Original Message-
From: Floyd Resler [mailto:fres...@adex-intl.com]
Sent: Wednesday, April 11, 2012 11:26 AM
To: PHP
Subject: [PHP] Sorting Help
I need to sort the following array:
{
[Smith, Bob]=array(137.5,125.5),
[Jones, Robert]=array(132.7,128.2)
}
The array needs
-Original Message-
From: Floyd Resler [mailto:fres...@adex-intl.com]
Sent: Wednesday, April 11, 2012 11:26 AM
To: PHP
Subject: [PHP] Sorting Help
I need to sort the following array:
{
[Smith, Bob]=array(137.5,125.5),
[Jones, Robert]=array(132.7,128.2)
}
The array needs
On Apr 11, 2012, at 1:11 PM, admin wrote:
-Original Message-
From: Floyd Resler [mailto:fres...@adex-intl.com]
Sent: Wednesday, April 11, 2012 11:26 AM
To: PHP
Subject: [PHP] Sorting Help
I need to sort the following array:
{
[Smith, Bob]=array(137.5,125.5
On 11 Apr 2012, at 16:26, Floyd Resler wrote:
I need to sort the following array:
{
[Smith, Bob]=array(137.5,125.5),
[Jones, Robert]=array(132.7,128.2)
}
The array needs to be sorted by the first number (i.e. 137.5) and then the
second in descending order. I looked at
Bastien Koert
On 2012-04-11, at 2:18 PM, Floyd Resler fres...@adex-intl.com wrote:
On Apr 11, 2012, at 1:11 PM, admin wrote:
-Original Message-
From: Floyd Resler [mailto:fres...@adex-intl.com]
Sent: Wednesday, April 11, 2012 11:26 AM
To: PHP
Subject: [PHP] Sorting Help
On 2/28/2011 7:52 PM, Ron Piggott wrote:
I need help to know how to sort the words / phrases in my array.
Variable name: $words_used
print_r( $words_used ); Current output: Array ( [187] = Sin [249] =
Punished [98] = Sanctuary [596] = Sing [362] = Anointing Oil )
Desired result:
I need help to know how to sort the words / phrases in my array.
Variable name: $words_used
print_r( $words_used ); Current output: Array ( [187] = Sin [249] = Punished
[98] = Sanctuary [596] = Sing [362] = Anointing Oil )
Desired result: Alphabetical sort: Array ( [362] = Anointing Oil [249] =
On 1/03/2011, at 4:52 PM, Ron Piggott wrote:
I need help to know how to sort the words / phrases in my array.
Variable name: $words_used
print_r( $words_used ); Current output: Array ( [187] = Sin [249] =
Punished [98] = Sanctuary [596] = Sing [362] = Anointing Oil )
Desired result:
Hey everyone. I have an array that looks like this:
$main_array[0] = array('key1' = 'vala');
$main_array[1] = array('key1' = 'valb');
etc.
I want to sort the main array based on the value of key1 for each
sub-array. I looked at all the array sorting functions, but unless I
misunderstood
On Sun, Sep 6, 2009 at 6:45 PM, James Colanninoja...@colannino.org wrote:
Hey everyone. I have an array that looks like this:
$main_array[0] = array('key1' = 'vala');
$main_array[1] = array('key1' = 'valb');
etc.
I want to sort the main array based on the value of key1 for each
sub-array.
Eddie Drapkin wrote:
http://us3.php.net/uasort
Exactly what I was looking for. Thanks.
James
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
In case anyone else was wondering, the command to use is COALESCE()
as in:
$theQuery = mysql_query(select variousFields from theTable where
date = '$currDate' ORDER BY COALESCE(rotime2,rotime1,time));
COALESCE() will use one of the variables, being the one it finds a
value for first,
Hi all. Am trying to sort baseball games by time, where there can be
up to 3 times listed per game.
Each game has an original date and time field, plus fields for 2
rain-out dates/times (rodate1 rotime1, rodate2, rotime2), to
use if the game gets rained out. Note that rotime1 and rotime2
Just a draft i thought should not go unnoticed on the list :-) just cleaning
up.
OK,
How about a super efficient soln where each string is only converted once
and a fast sorting algorithm is used:
?php
function time_sort($a, $b) {
static $now = time();
if (strtotime($a, $now) ==
At 9:31 PM -0600 2/14/09, Shawn McKenzie wrote:
Yeah, hif I had known that you wanted a function where you loop through
your array twice, that would have done it. Bravo.
Shawn:
I don't see another way. You go through the array converting string
to time (seconds), sort, and then convert
tedd wrote:
At 9:31 PM -0600 2/14/09, Shawn McKenzie wrote:
Yeah, hif I had known that you wanted a function where you loop through
your array twice, that would have done it. Bravo.
Shawn:
I don't see another way. You go through the array converting string to
time (seconds), sort, and
Hi gang:
Anyone have/know a routine that will sort an array of times?
For example, a function that would take an array like this:
time[0] ~ '1:30pm'
time[1] ~ '7:30am'
time[2] ~ '12:30pm'
and order it to:
time[0] ~ '7:30am'
time[1] ~ '12:30pm'
time[2] ~ '1:30pm'
Cheers,
tedd
--
---
1. convert the string representation of times to timestamps using
strtotime()
2. sort the timestamps
3. display the timestamps as strings using date('format', timestamp)
Would that work?
John Corry
email: jco...@gmail.com
On Feb 14, 2009, at 4:07 PM, tedd wrote:
Hi gang:
Anyone
John Corry wrote:
1. convert the string representation of times to timestamps using
strtotime()
2. sort the timestamps
3. display the timestamps as strings using date('format', timestamp)
Would that work?
John Corry
email: jco...@gmail.com
On Feb 14, 2009, at 4:07 PM, tedd
At 4:15 PM -0500 2/14/09, John Corry wrote:
1. convert the string representation of times to timestamps using strtotime()
2. sort the timestamps
3. display the timestamps as strings using date('format', timestamp)
Would that work?
John Corry
email: jco...@gmail.com
John:
Bingo -- that
tedd wrote:
At 4:15 PM -0500 2/14/09, John Corry wrote:
1. convert the string representation of times to timestamps using
strtotime()
2. sort the timestamps
3. display the timestamps as strings using date('format', timestamp)
Would that work?
John Corry
email: jco...@gmail.com
John:
I'm having a problem sorting my array and wondered if anybody had experience
sorting arrays by their values. What I need to do is resort the array below
where the most expensive product shipping price starts at position zero no
matter how big the array is.
array(2) {
[0] = array(48) {
I believe you'll need a custom sorting function for this.
http://us.php.net/usort
Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com
Tom Shaw wrote:
I'm having a problem sorting my array and wondered if anybody had experience
sorting arrays by their values.
Yeah, a bubble sorting algorithm should fix it, as it essentially only a
very simple sort required.
Ash
www.ashleysheridan.co.uk
---BeginMessage---
I believe you'll need a custom sorting function for this.
http://us.php.net/usort
Thank you,
Micah Gersten
onShore Networks
Internal Developer
message attachment, Forwarded message - Re: [PHP] Sorting
Arrays
Forwarded Message
From: Micah Gersten [EMAIL PROTECTED]
To: Tom Shaw [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Subject: Re: [PHP] Sorting Arrays
Date: Fri, 22 Aug 2008 14:18:53 -0500
I believe
Robert Cummings wrote:
On Fri, 2008-08-22 at 21:04 +0100, Ashley Sheridan wrote:
Yeah, a bubble sorting algorithm should fix it, as it essentially only
a very simple sort required.
Why use bubble sort when you can use usort() function with an arbitrary
handler?
Cheers,
Rob.
Tom Shaw wrote:
I'm having a problem sorting my array and wondered if anybody had experience
sorting arrays by their values. What I need to do is resort the array below
where the most expensive product shipping price starts at position zero no
matter how big the array is.
array(2) {
Steve Marquez wrote:
I know this code does not work, but I was curious if someone can take a look
and tell me what is wrong? Thank you so much.
Re-indent your code properly. If you do it will look like:
?php
$pattern = .html*|.php*;
if (is_dir(files/)) {
if ($dh = opendir(files/)) {
Greetings,
I have some code that opens a directory and displays the files. I want to
display the files in Alphabetical order.
I know this code does not work, but I was curious if someone can take a look
and tell me what is wrong? Thank you so much.
form name=select_page method=post action=
Steve Marquez wrote:
Greetings,
I have some code that opens a directory and displays the files. I want to
display the files in Alphabetical order.
I know this code does not work, but I was curious if someone can take a look
and tell me what is wrong? Thank you so much.
[ I hope the indenting
Yep, that would be the perfect solution, but, unfortunately, database
is not an option for this project. Thanks for looking! I did get a
solution though from another list.
Here is a working version:
http://veanndesign.com/sorting.php
compare it to the not working one:
If you are going to sort it by various fields, I'd just throw it into
a database...
That said, http://php.net/usort should be able to do whatever you want.
On Thu, May 10, 2007 2:18 pm, Anna Vester wrote:
Hello all,
I have a question concerning .CSV array sorting. I have tried googling
for
On Thu, May 10, 2007 1:00 pm, James Tu wrote:
(I've cross posted at the MySQL list as well)
Here's an example with a simple table:
describe collection;
+--+-+--+-
+-++
| Field| Type
(I've cross posted at the MySQL list as well)
Here's an example with a simple table:
describe collection;
+--+-+--+-
+-++
| Field| Type| Null | Key |
Default | Extra
James Tu wrote:
(I've cross posted at the MySQL list as well)
Here's an example with a simple table:
describe collection;
+--+-+--+-
+-++
Field| Type| Null | Key |
Default
On Thu, 2007-05-10 at 14:00 -0400, James Tu wrote:
(I've cross posted at the MySQL list as well)
Here's an example with a simple table:
describe collection;
+--+-+--+-
+-++
| Field| Type
Hello all,
I have a question concerning .CSV array sorting. I have tried googling
for an answer and have tried different techniques, but nothing seems
to works as I would like it to work. Here is my situation:
Test file is located here: http://veanndesign.com/test.php
I would like to be able to
One place to start reading, Anna, would be the PHP manual for the
fgetcsv() function, which is specifically for CSV parsing.
http://www.php.net/fgetcsv
On 5/10/07, Anna Vester [EMAIL PROTECTED] wrote:
Hello all,
I have a question concerning .CSV array sorting. I have tried googling
for
On 5/10/07, Daniel Brown [EMAIL PROTECTED] wrote:
One place to start reading, Anna, would be the PHP manual for the
fgetcsv() function, which is specifically for CSV parsing.
http://www.php.net/fgetcsv
Thanks for your quick reply Daniel. Yes I've seen that function before
and i am
When you load your data into your array, you can use the timezone (or whatever
field you're using to sort) as the array key, then use ksort().
Check the see also for a bunch of other types of sorting you can do.
When it comes to the multisorts and user defined sorts, I'm at a bit of a
A somewhat more extensible version of the 1 query method:
http://www.garfieldtech.com/blog/php-group-by
If you will only ever have 2 values there, then either method is probably
fine. The php group by method (above) is more extensible if you're going
to have a variable or arbitrary number of
hi,
I have the following array, which I need to sort by quantity...
Array
(
[2408] = Array
(
[name] = Havaianas Top Pink Crystal
[size] = 5 (37/38)
[quantity] = 4
)
[3388] = Array
(
[name] = Havaianas Brazil Silver
Jon, I would suggest that you should have a look at the function
array_multisort. See the manual for details on what this function
is capable of.
//frank
25 apr 2007 kl. 01.58 skrev Jon Bennett:
hi,
I have the following array, which I need to sort by quantity...
Array
(
[2408] = Array
I have the following array, which I need to sort by quantity...
I need to keep the indexes if poss.
This may not be the most elegant solution. Let's call your array
$origArray
$tmpArray = array();
foreach( $origArray as $elKey = $elArray ) {
$tmpArray[$elArray['quantity']] = $elKey;
}
if(
2007. 04. 25, szerda keltezéssel 11.39-kor Chris Boget ezt írta:
I have the following array, which I need to sort by quantity...
I need to keep the indexes if poss.
This may not be the most elegant solution. Let's call your array
$origArray
$tmpArray = array();
foreach( $origArray as
this won't work if he has the same quantity for several keys, I think
Yes, you are correct. If that is the case, then you would just need to
change the following line
$tmpArray[$elArray['quantity']] = $elKey;
to
$tmpArray[$elArray['quantity']][] = $elKey;
then change logic in this loop:
array_multisort accepts column arrays but here you try to sort row based
arrays.
try this:
?
class ArrayUtility
{
/* Sorts an array by a member */
static private $sortMember;
static function sortByMember($array, $member)
{
self::$sortMember = $member;
Jon Bennett wrote:
hi,
I have the following array, which I need to sort by quantity...
Array
(
[2408] = Array
(
[name] = Havaianas Top Pink Crystal
[size] = 5 (37/38)
[quantity] = 4
)
[3388] = Array
(
[name] = Havaianas
Search the archives for multisort array and you should find this
thread a few thousand times...
On Tue, April 24, 2007 6:58 pm, Jon Bennett wrote:
hi,
I have the following array, which I need to sort by quantity...
Array
(
[2408] = Array
(
[name] = Havaianas Top
Hi all. I am building an online events directory and as part of the system
users can search for events by date, category etc.
The logic involved in finding events that match the user-entered dates works
like so:
1. we create a range of dates from the start and end dates specified by the
user
2.
# [EMAIL PROTECTED] / 2007-02-08 14:08:13 +:
Hi all. I am building an online events directory and as part of the system
users can search for events by date, category etc.
The logic involved in finding events that match the user-entered dates works
like so:
1. we create a range of
Thanks for that - can't do that as all I know in the database is the start
and end date for each event (so I don't have to create mapping tables and
perform massive joins), the rest is handle dynamically.
I think I can do it using usort, this seems to work, any comments?
function compare($x,
array_multisort?
http://php.net/manual/en/function.array-multisort.php
hope that helps
Zoltán Németh
On cs, 2007-02-08 at 14:08 +, Dave Goodchild wrote:
Hi all. I am building an online events directory and as part of the system
users can search for events by date, category etc.
The
How about this:
http://uk.php.net/manual/en/function.array-multisort.php#53779
Edward
-Original Message-
From: Dave Goodchild [mailto:[EMAIL PROTECTED]
Sent: 08 February 2007 14:30
To: Roman Neuhauser
Cc: php-general@lists.php.net
Subject: Re: [PHP] Sorting a multidimensional array
Paul's probably right.. putting the sorting values in a table would be eaiser
to maintain. I don't know what I was thinking with the whole then you don't
HAVE to create a table. Both ways work.. but especially if you think the
positions may change, then it'll be tons easier to update if
I have been trying to figure out how to get this to work for a couple of
days.
I need to sort the results of a DB query based on the hierarchy of positions
within an organization. Since they are not necessarily alphabetical, the
best I can come up with is to assign a numerical value in a
Well, kind of ugly but you can do something like this:
SELECT Position, CASE Position WHEN 'CEO' THEN 1 WHEN 'COO' THEN 2 WHEN 'CFO'
THEN 3 WHEN 'HR' THEN 4 ELSE 99 END AS PositionSort
FROM SomeTable
ORDER BY PositionSort
That way you're not creating a whole new table to store the sorting
= = = Original message = = =
I need to sort the results of a DB query based on the hierarchy of positions
within an organization. Since they are not necessarily alphabetical, the
best I can come up with is to assign a numerical value in a separate table
to each position, and reference that to
Hi all. I have a multidimensional array here:
array(6) { [0]= array(25) { [0]= string(1) 7 [eventid]= string(1) 7
[1]= string(2) 17 [cat_id]= string(2) 17 [2]= string(13) Tits And
Bums [name]= string(13) Tits And Bums [3]= string(19) The Pleasure
Centre [venue]= string(19) The Pleasure Centre
On Thu, 2006-11-16 at 15:28 +, Dave Goodchild wrote:
Hi all. I have a multidimensional array here:
Bums [name]= string(13) Tits And Bums [3]= string(19) The Pleasure
[--SNIP--]
...which comprises a set of returned results for an events search - with the
date computed dynamically and
Result. Cheers!
On 11/16/06, Robert Cummings [EMAIL PROTECTED] wrote:
On Thu, 2006-11-16 at 15:28 +, Dave Goodchild wrote:
Hi all. I have a multidimensional array here:
Bums [name]= string(13) Tits And Bums [3]= string(19) The
Pleasure
[--SNIP--]
...which comprises a set of returned
On 07/11/06, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
you really need to deal with this issue at the database design/data
entry level. doing things on the sort to exclude (otherwise undefined)
initial articles (as some have suggested) is very maintenance heavy as
you have to update the sort
At 3:13 PM +0200 11/5/06, Dotan Cohen wrote:
I have a list of subjects, such as Linux, Open Source, and the
World Wide Web. The subjects are stored in a database and being
retrieved via php. I currently organize them alphabetically with SQL's
ORDER BY ASC argument, however, if there is a
On 11/5/06, Roman Neuhauser [EMAIL PROTECTED] wrote:
If you used PostgreSQL I'd suggest a functional index and ordering
on the function... Does MySQL have anything like this?
CREATE FUNCTION fn(TEXT)
RETURNS TEXT
IMMUTABLE STRICT
LANGUAGE SQL
AS $$
SELECT
On Sun, November 5, 2006 7:13 am, Dotan Cohen wrote:
I have a list of subjects, such as Linux, Open Source, and the
World Wide Web. The subjects are stored in a database and being
retrieved via php. I currently organize them alphabetically with SQL's
ORDER BY ASC argument, however, if there is
On 06/11/06, Richard Lynch [EMAIL PROTECTED] wrote:
On Sun, November 5, 2006 7:13 am, Dotan Cohen wrote:
I have a list of subjects, such as Linux, Open Source, and the
World Wide Web. The subjects are stored in a database and being
retrieved via php. I currently organize them alphabetically
On Monday 06 November 2006 08:15, clive wrote:
Current code:
$query = SELECT subject FROM table ORDER BY subject asc;
$result = mysql_query($query);
I dont seen any php code to do any sorting,just a mysql query, perhaps a
mysql list or maybe you should try doing it in php yourself first.
I have a list of subjects, such as Linux, Open Source, and the
World Wide Web. The subjects are stored in a database and being
retrieved via php. I currently organize them alphabetically with SQL's
ORDER BY ASC argument, however, if there is a preceding the or a
then that is considered as part
# [EMAIL PROTECTED] / 2006-11-05 15:13:19 +0200:
I have a list of subjects, such as Linux, Open Source, and the
World Wide Web. The subjects are stored in a database and being
retrieved via php. I currently organize them alphabetically with SQL's
ORDER BY ASC argument, however, if there is a
Current code:
$query = SELECT subject FROM table ORDER BY subject asc;
$result = mysql_query($query);
I dont seen any php code to do any sorting,just a mysql query, perhaps a
mysql list or maybe you should try doing it in php yourself first.
Not that I know the answer, but mysql does have
On Tue, October 31, 2006 11:10 am, Keith Spiller wrote:
RE: Sorting Multidimensional Array
I'm trying to sort a multidimensional array. The data was taken from
a mysql query:
$myrow = mysql_fetch_row($result) {
query[] = $myrow;
}
The purpose is to retrieve the table data and
Subject: Re: [PHP] Sorting Multidimensional Array
On Tue, October 31, 2006 11:10 am, Keith Spiller wrote:
RE: Sorting Multidimensional Array
I'm trying to sort a multidimensional array. The data was taken from
a mysql query:
$myrow = mysql_fetch_row($result) {
query[] = $myrow
Hi,
RE: Sorting Multidimensional Array
I'm trying to sort a multidimensional array. The data was taken from
a mysql query:
$myrow = mysql_fetch_row($result) {
query[] = $myrow;
}
The purpose is to retrieve the table data and manually add a record,
then sort ASC by the startdate which is
hi to all!
I have an array of products $products
$products = array_count_values($products);
now I have an array where $key is product number and $value is how many
times I have such a product in the array.
I want to sort this new array that product with the most duplicates are
on the first place,
On Tue, August 15, 2006 9:01 am, [EMAIL PROTECTED] wrote:
I have an array of products $products
$products = array_count_values($products);
now I have an array where $key is product number and $value is how
many
times I have such a product in the array.
I want to sort this new array that
;
}
-Original Message-
From: weetat [mailto:[EMAIL PROTECTED]
Sent: Monday, July 31, 2006 12:32 PM
To: php-general@lists.php.net
Subject: [PHP] sorting in array
Hi all ,
I have array value as shown below, i have paste my test php code
below:
I have problem when doing usort() when 'country
Message-
From: weetat [mailto:[EMAIL PROTECTED]
Sent: Monday, July 31, 2006 12:32 PM
To: php-general@lists.php.net
Subject: [PHP] sorting in array
Hi all ,
I have array value as shown below, i have paste my test php code below:
I have problem when doing usort() when 'country' = '', i would
At 10:31 PM 7/30/2006, weetat wrote:
I have problem when doing usort() when 'country' = '', i would
like to display records where country = '' last. Any ideas how to do that ?
...
$arraytest= array(
array
(
'country' = '',
)
,
array
(
At 05:40 PM 7/30/2006, Peter Lauri wrote:
function cmpcountry($a, $b)
{
$country1 = $a['country'];
$country2 = $b['country'];
if($country1=='') return 1;
else return ($country1 $country2) ? -1 : 1;
}
Good call, Peter; my suggestion was
At 12:22 AM 7/31/2006, Paul Novitski wrote:
I could make that last statement just a bit simpler:
function cmpcountry($a, $b)
{
$country1 = ($a['country'] == '') ? zzz : $a['country'];
$country2 = ($b['country'] == '') ? zzz : $b['country'];
return ($country1
Thanks Paul,
Very weird tried Peter's option, it doesn't work.
Btw , how to sort by ascending ?
Thanks
Paul Novitski wrote:
At 12:22 AM 7/31/2006, Paul Novitski wrote:
I could make that last statement just a bit simpler:
function cmpcountry($a, $b)
{
$country1 =
At 01:14 AM 7/31/2006, weetat wrote:
Thanks Paul,
Very weird tried Peter's option, it doesn't work.
Btw , how to sort by ascending ?
Please explain what you mean. The current script DOES sort ascending
by country (except for the blank country fields which are placed at the end):
: Re: [PHP] sorting in array
Thanks Paul,
Very weird tried Peter's option, it doesn't work.
Btw , how to sort by ascending ?
Thanks
Paul Novitski wrote:
At 12:22 AM 7/31/2006, Paul Novitski wrote:
I could make that last statement just a bit simpler:
function cmpcountry($a, $b
@lists.php.net
Subject: Re: [PHP] sorting in array
At 10:31 PM 7/30/2006, weetat wrote:
I have problem when doing usort() when 'country' = '', i would
like to display records where country = '' last. Any ideas how to do that
?
...
$arraytest= array(
array
weetat wrote:
Hi all ,
I have array value as shown below, i have paste my test php code below:
I have problem when doing usort() when 'country' = '', i would like to
display records where country = '' last. Any ideas how to do that ?
...
You might try searching the list's archive's.
Hi all ,
I have array value as shown below, i have paste my test php code below:
I have problem when doing usort() when 'country' = '', i would like to
display records where country = '' last. Any ideas how to do that ?
Thanks
$arraytest= array(
array
(
'country'
31, 2006 12:32 PM
To: php-general@lists.php.net
Subject: [PHP] sorting in array
Hi all ,
I have array value as shown below, i have paste my test php code below:
I have problem when doing usort() when 'country' = '', i would like to
display records where country = '' last. Any ideas how to do
Hi all,
Need some advice as to how to sort a array:
Structure:
partnerID
partnerName
total
totalPaid
totalUnpaid
So basically there will be many entries for the following:
eg:
partnerID | partnerName | total | totalPaid | totalUnpaid
1 marc 12 5
On 7/26/06, Angelo Zanetti [EMAIL PROTECTED] wrote:
Hi all,
So they way I want to sort these rows is by total, totalPaid,
totalUnpaid all descending.
Hi Angelo,
So the first question the list will ask is if the array of data is
coming from a database. Because then you'd be urged to perform
hi guys,
thanks for the replies! yes Melanie, you were correct the last example
(i had an old version of the manual). seemed to do the trick =)
Thanks to john as well for the reply.
Angelo
Melanie Maddix wrote:
[snip]
So they way I want to sort these rows is by total, totalPaid,
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
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,
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
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
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
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
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? Like
A20
B17
B16
C15
C14
D13
D12
Thanks
-Will
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,
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
1 - 100 of 388 matches
Mail list logo