Re: [PHP] Array Sorting

2006-05-05 Thread tedd
On Thu, May 4, 2006 10:20 am, James Nunnerley wrote: What I'm not sure about doing is sorting by say Size or Date? There's several different examples of date sorts here: http://www.weberdev.com/AdvancedSearch.php?searchtype=titlesearch=date+sortSubmit1.x=0Submit1.y=0 HTH's tedd --

[PHP] Array Sorting

2006-05-04 Thread James Nunnerley
Hi All, I've got an array which has the following properties: $file_array[$filename] = array (Date = $Date, size = $size, permissions = $permissions); I can quite happily sort the array by filename (using natksort and natkrsort), which I found on the php manual - and for reference have included

Re: [PHP] Array Sorting

2006-05-04 Thread Stut
James Nunnerley wrote: I've got an array which has the following properties: $file_array[$filename] = array (Date = $Date, size = $size, permissions = $permissions); I can quite happily sort the array by filename (using natksort and natkrsort), which I found on the php manual - and for

RE: [PHP] Array Sorting

2006-05-04 Thread James Nunnerley
don't think so, but would be happy to be corrected! Cheers Nunners -Original Message- From: Stut [mailto:[EMAIL PROTECTED] Sent: 04 May 2006 16:24 To: James Nunnerley Cc: php-general@lists.php.net Subject: Re: [PHP] Array Sorting James Nunnerley wrote: I've got an array which has

Re: [PHP] Array Sorting

2006-05-04 Thread Stut
James Nunnerley wrote: I think I may have written down my variable structure incorrectly in the first place, which even has me confused... The $file_array[$filename] is I don't think a further array. The sub values are created as follows: $file_array[$filename][Date] = ...

Re: [PHP] Array Sorting

2006-05-04 Thread Richard Lynch
On Thu, May 4, 2006 10:20 am, James Nunnerley wrote: $file_array[$filename] = array (Date = $Date, size = $size, permissions = $permissions); I can quite happily sort the array by filename (using natksort and natkrsort), which I found on the php manual - and for reference have included as a

Re: [PHP] Array Sorting

2006-05-04 Thread Richard Lynch
On Thu, May 4, 2006 10:47 am, Stut wrote: It's worth noting that if you're not using the fact that they're indexed on the filename it's probably faster to use integer keys instead of strings, but don't quote me on that. I'm not overly familiar with the internals of PHP... yet! I think this

[PHP] array sorting

2005-03-27 Thread Merlin
Hi there, I would like to save some db power by putting values into a file which are often used. They basicly populate a select field. So I placed those values into associative arrays: $code[language] = array(1= php, 2= asp); Now I would like to sort those for displaying after my preference, not

[PHP] Array Sorting Headaches

2004-04-18 Thread Burhan Khalid
Greetings everyone : Having a hard time with this one. I have a multi-dim array $foo[$x][$y]['key'], where $x and $y are numeric. Here is some sample data : Array ( [$x] = Array ( [0] = Array ( [invoiceid] = 11842

[PHP] Array Sorting, 2 items...

2003-07-22 Thread Dan Joseph
Hi, Trying to accomplish: I want to sort my array by two columns. The array is setup: Array ( [0] = Array ( [0] = CHECKING [ba_type] = CHECKING [1] = 10132200 [loan_number] = 10132200 [2] =

Re: [PHP] Array Sorting, 2 items...

2003-07-22 Thread Marek Kilimajer
Your array seems like a result of mysql_fetch_array(), cannot you order it in the sql query? Dan Joseph wrote: Array ( [0] = Array ( [0] = CHECKING [ba_type] = CHECKING [1] = 10132200 [loan_number] = 10132200 Keep

RE: [PHP] Array Sorting, 2 items...

2003-07-22 Thread Dan Joseph
doing something wrong there? -Dan Joseph -Original Message- From: Marek Kilimajer [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 11:25 AM To: Dan Joseph Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Array Sorting, 2 items... Your array seems like a result of mysql_fetch_array

RE: [PHP] Array Sorting, 2 items...

2003-07-22 Thread Ford, Mike [LSS]
-Original Message- From: Dan Joseph [mailto:[EMAIL PROTECTED] Sent: 22 July 2003 16:29 Yeah, I did get it from a mysql_fetch_array(). I have: ORDER BY payment_methods.ba_type ASC, loan_info.loan_number ASC However,

RE: [PHP] Array Sorting, 2 items...

2003-07-22 Thread Dan Joseph
for without having to do a usort? -Dan Joseph -Original Message- From: Ford, Mike [LSS] [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 11:39 AM To: 'Dan Joseph'; [EMAIL PROTECTED] Subject: RE: [PHP] Array Sorting, 2 items... -Original Message- From: Dan Joseph

Re: [PHP] Array Sorting, 2 items...

2003-07-22 Thread Curt Zirzow
* Thus wrote Dan Joseph ([EMAIL PROTECTED]): Eek... Yes, I did past it wrong... SELECT payment_methods.ba_type, loan_info.loan_number, loan_info.id AS loan_id, cust_info.first_name, cust_info.last_name, transactions.approved_date, payment_types.type FROM loan_info, cust_info, transactions,

RE: [PHP] Array Sorting, 2 items...

2003-07-22 Thread Dan Joseph
: Ford, Mike [LSS] [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 22, 2003 11:39 AM To: 'Dan Joseph'; [EMAIL PROTECTED] Subject: RE: [PHP] Array Sorting, 2 items... -Original Message- From: Dan Joseph [mailto:[EMAIL PROTECTED] Sent: 22 July 2003 16:29 Yeah, I did get it from

RE: [PHP] Array Sorting, 2 items...

2003-07-22 Thread Dan Joseph
] Sent: Tuesday, July 22, 2003 11:25 AM To: Dan Joseph Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Array Sorting, 2 items... Your array seems like a result of mysql_fetch_array(), cannot you order it in the sql query? Dan Joseph wrote: Array ( [0] = Array

[PHP] Array Sorting

2003-06-19 Thread Ashley M. Kirchner
I have an array that looks like this: $i = 0; $item[$i] = array( 'link' = 'http://...', 'image' = '/images/image.jpg', 'title' = 'some title', 'price' = '$14.00', 'cat'= 'Frames', 'author' =

Re: [PHP] Array Sorting

2003-06-19 Thread Marek Kilimajer
Use usort. This function should do the work: function cmp ($a, $b) { if ($a['manufacturer'] == $b['manufacturer']) return 0; return ($a['manufacturer'] $b['manufacturer']) ? -1 : 1; } Ashley M. Kirchner wrote: I have an array that looks like this: $i = 0; $item[$i] = array( 'link'

Re: [PHP] Array Sorting

2003-06-19 Thread Ashley M. Kirchner
Marek Kilimajer wrote: Use usort. This function should do the work: Hey thanks! That worked like a charm, once I figured out that making the comparison instead of I would get an ascending sort instead of the descending one. Now, can I do multiple sorts? Like, sort on cat first,

Re: [PHP] Array Sorting

2003-06-19 Thread Marek Kilimajer
Yes, simply don't return 0 when the manufacturers are equal, but continue with other checks: function cmp ($a, $b) { if ($a['cat'] == $b['cat']) { // return 0; -- not anymore, but go on to compare manuf. if ($a['manufacturer'] == $b['manufacturer']) { if

Re: [PHP] Array Sorting

2003-06-19 Thread Marek Kilimajer
BTW, this is what I always receive when mailing you: Final-Recipient: RFC822; [EMAIL PROTECTED] Action: failed Status: 5.7.1 Remote-MTA: DNS; serpico.pcraft.com Diagnostic-Code: SMTP; 554 5.7.1 Original message rejected due to high SPAM score: 97.4 Last-Attempt-Date: Thu, 19 Jun 2003 11:36:23

Re: [PHP] Array Sorting

2003-06-19 Thread Ashley M. Kirchner
Marek Kilimajer wrote: BTW, this is what I always receive when mailing you: Diagnostic-Code: SMTP; 554 5.7.1 Original message rejected due to high SPAM score: 97.4 Hrm, yes. Has to do with your .sk domain I'm sure. Bloody automatic filters. Thanks for the function, it works as

[PHP] Array sorting

2003-02-07 Thread Zydox
My question is if anyone have any idé on how to sort this array so that the names and ages are sorted after Close Friend, Friend, Wife and last Family... $A[] = array (Nils, 23, Friend); $A[] = array (Emma, 21, Friend); $A[] = array (Cassie, 21, Wife); $A[] = array (Zydox, 23, Friend); $A[] =

[PHP] Array Sorting

2002-06-12 Thread Steve Buehler
I have looked through php.net and the books that I have and I am confused, so I hope that someone can help me out here. I am trying to sort an array that I have. I use a while statement to fill the array: $teams[++$i][team_id]=$row-team_id; $teams[$i][name]=$row1-name;