Current location: Hot Scripts Forums » Programming Languages » PHP » Help with ORDER


Help with ORDER

Reply
  #1 (permalink)  
Old 08-07-09, 12:27 AM
siemens15 siemens15 is offline
Newbie Coder
 
Join Date: Jul 2009
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Help with ORDER

Hello, I have this script :
Code:
    $query.="WHERE u.level >=7 ";
    $query.="AND u.level <=10 ";
    $query.="ORDER BY u.id_level DESC, u.id ASC";
Because I can't change user's levels I want to order first u.level 9 then u.level 8 then u.level 10 ( instead 7 ) and u.level 7 after 10 how ?
Reply With Quote
  #2 (permalink)  
Old 08-07-09, 12:44 AM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
Hope these are helpful.

MySQL :: MySQL 5.1 Reference Manual :: 3.6.4 The Rows Holding the Group-wise Maximum of a Certain Field

MySQL :: MySQL 5.1 Reference Manual :: 11.3 Control Flow Functions

You might want to read all the data into an array, then modify the user_levels / sort on them. Might be easier than trying to get it out of SQL.

Good luck.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Multi script PayPal add to cart order form Tito1 JavaScript 5 02-23-09 04:21 AM
Order By Group By Distinct Problem pedramphp Database 2 02-21-09 08:11 AM
Order record ema85b PHP 0 10-25-05 09:24 AM
Revised Default Sorting Order relledge General HotScripts Site Discussion 6 09-15-05 09:50 AM
asp: values in array not in order?? seala ASP 0 08-16-03 12:06 PM


All times are GMT -5. The time now is 07:56 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.