Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 06-24-2003, 11:01 AM   #1 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,475
sde is on a distinguished road
sorting multi dimensional arrays

i'm confused .. i have something like this returning in mysql.

$browser[0][name]=Internet Explorer
$browser[0][count]=10

$browser[1][name]=Mozilla
$browser[1][count]=5

i want to re-index this array based on the count.
__________________
Mike
sde is offline   Reply With Quote
Old 10-01-2003, 11:23 AM   #2 (permalink)
Admin
$_['Your_Mom'];
 
Admin's Avatar
 
Join Date: May 2002
Location: Santee
Posts: 627
Admin is on a distinguished road
multi dimensional arrays make my head hurt.
__________________


Urban Clothing
Admin is offline   Reply With Quote
Old 10-01-2003, 11:56 AM   #3 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,475
sde is on a distinguished road
i've been using them more lately .. like in the ups class i made to get shipping prices. i just setup a bunch of multi-dimensional arrays which store the set ups info for shipping type, package type, pickup type, etc..

sorta off the topic, but i use curl to send/receive xml data .. check this out: http://milanointeractive.com/xml/ups.php
__________________
Mike
sde is offline   Reply With Quote
Old 10-01-2003, 02:51 PM   #4 (permalink)
npa
Code Monkey
 
Join Date: Jul 2003
Location: canada
Posts: 82
npa is on a distinguished road
just sort it like a one-d one but sort the
2nd-d as you do it.

... ?

c code for quick-sort:
http://www.kishwaukeecollege.edu/fac...de_qksort.html

i adapted that to sort two-d in asp.
__________________
direct entry file specification.
npa is offline   Reply With Quote
Old 10-01-2003, 05:52 PM   #5 (permalink)
bdl
Senior Contributor
 
Join Date: May 2002
Location: vta.ca.usa
Posts: 555
bdl is on a distinguished road
This works:

PHP Code:
for ($i 0$i count($browser); $i++) {
    
$tmparray[$i]['count'] = $browser[$i]['count'];
    
$tmparray[$i]['name'] = $browser[$i]['name'];
}
sort($tmparray);
$browser $tmparray
bdl is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sorting objects arrays by object properties sde Java 28 08-05-2004 05:51 AM
working with Multi Dimensional Arrays sde PHP 7 07-11-2004 01:43 PM


All times are GMT -8. The time now is 10:43 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting