Register | Login | |||||
Main
| Memberlist
| Active users
| ACS
| Commons
| Calendar
| Online users Ranks | FAQ | Color Chart | Photo album | IRC Chat |
| |
0 user currently in Programming. | 3 guests |
Acmlm's Board - I2 Archive - Programming - PHP & MySQL: Ordering Something That's Already Ordered | | | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
User | Post | ||
Elric Chasupa Currently Playing: You Like A Lute. Level: 40 Posts: 527/687 EXP: 440016 For next: 1293 Since: 03-15-04 From: Melniboné Since last post: 6 hours Last activity: 6 hours |
| ||
How would I go about ordering something after I already ordered it when I pulled it from the DB? For example: $things=mysql_query("SELECT stuff,crap FROM table ORDER BY stuff DESC LIMIT 0,5); This is where I get stuck. If the 5 values for stuff are, say 100,75,66,32, and 8 , and the 5 values for crap are 0,10,60,3, and 2 , then after you subtract those, the new values for stuff are now 100,65,6,29, and 5 . Since I initially ordered them by stuff , when I print $list to the screen, they'll show up in that order. But I want them to show up in their new descending order of 100,65,29,6, and 5 .Is there a command to do this, or will I have to code a new function to do this? |
|||
sloat Level: 16 Posts: 79/85 EXP: 18044 For next: 2212 Since: 05-21-04 From: South Central Delaware Since last post: 19 days Last activity: 5 hours |
| ||
try something like, "SELECT (stuff - crap) AS blah FROM table ORDER BY blah DESC" php also has array sort functions if that doesn't work. |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
Acmlm's Board - I2 Archive - Programming - PHP & MySQL: Ordering Something That's Already Ordered | | | |