General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 14th, 2003, 08:30 AM
DDDooGGG DDDooGGG is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Melbourne, Australia
Posts: 97 DDDooGGG User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 m 33 sec
Reputation Power: 6
Question Sorting an Array

Hi, i need some help with the following:
-I want to select 3 columns from a table, i.e. rank, name and team.
-I would then like to make an array something like this:
'rank, name, team' for each row.
-So the output should look like:
PHP Code:
 rank      name      team    score
5          jack      red    12
6          fred      red    11
1          john      red     8
2          sam      red      3
3          jim       blue    7
4          joe       blue    14 

- Before i output the results i want to multiply (rank x score) and then sort the the total in the array using the asort() command.

How do i do this?
__________________
regards,


Fulton

Last edited by DDDooGGG : August 14th, 2003 at 08:35 AM.

Reply With Quote
  #2  
Old August 14th, 2003, 11:17 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
Where's score coming from and what do you mean when you say you want to sort the total of the array?

You might try doing the math within your query, something like the following:

Code:

SELECT rank, name, team, (rank * score) as adjustment FROM table ORDER BY adjustment ASC

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Sorting an Array


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT