tags:

views:

72

answers:

2

here's the code:

$sql_namesResult = mysql_query("SELECT name  FROM `scrimaprovedlist` ORDER BY `scrimaprovedlist`.`eorank`");

eo rank is a NUMERICAL value for a rank (general, colonel, ect).

The problem is, when i set myself for 1, i am the top, but comes rank 10, instead of rank 2. how do i edit this to make it show in order:

1
2
3
10
20
30

I'm currently using "rank" instead of "eorank" because it is easier. but the problem is i have to manually edit the ranks over and over again so that they show in the correct order. Any ideas?

Viewable at http://www.thexcrew.com/modules.php?name=Roster

+4  A: 
ORDER BY CAST(scrimaprovedlist.eorank AS INTEGER)

Your ranks are strings instead of integers so they will be sorted as a string unless you cast or convert them to integers which I've done above

Joe Philllips
I'd suggest updating the underlying table to make them INTEGER type, assuming the field only holds numbers.
Eli
A: 

figured out a way, i changed my Numerical value to an alphabetical value. using only 17 ranks, i am able to substitute #'s for letters. thanks for the help anyway :)

RaxinII
You're doing it a silly way. Whatever works I guess
Joe Philllips