Php Mysql ORDER BY help

hi guys
is it possible to manually assign which categories the mysql ORDER BY command should print?

i have a database like so
name level
a grade2
b grade1
c grade4
d grade3
e grade5
f 2ndyear
g 1styear
h 4thyear
i 3rdyear
j pending
k graduate

now what i want to happen is i want to output it like this
name level
a grade1
b grade2
c grade3
d grade4
e grade5
f 1styear
g 2ndyear
h 3rdyear
i 4thyear
j graduate
k pending

i tried to this code
$result = mysql_query(“SELECT * FROM students ORDER BY level”)

but this is the output i get
name level
a 1styear
b 2ndyear
c 3rdyear
d 4thyear
e grade1
f grade2
g grade3
h grade4
i grade5
j graduate
k pending

so does anyone know how?

Try:

SELECT * FROM students ORDER BY level ASC

i tried ASC but this is still what i get
name level
a 1styear
b 2ndyear
c 3rdyear
d 4thyear
e grade1
f grade2
g grade3
h grade4
i grade5
j graduate
k pending

and i also tried DESC but this is what i get
name level
a pending
b graduate
c grade5
d grade4
e grade3
f grade2
g grade1
h 4thyear
i 3rdyear
j 2ndyear
k 1styear

Those are the only way to sort them as such unless you manually sort them when u display them via php using IF statements and selecting the different levels 1 at a time.

ok thx

Sponsor our Newsletter | Privacy Policy | Terms of Service