Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ordering mysql

Status
Not open for further replies.

solex

Programmer
Feb 28, 2003
91
GB
hi, can i use mysql commands in php to out put sorted from eg 0-100 in a collom.

thanx in advance

solex
 
If I understand you correctly then :
yes.

Otherwise pass.

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
have you already the values in a table ??

select * from table order by fieldname
is the way how you order you're values
 
so:

"SELECT * FROM users ORDER BY score"

would out put from highest "score" to smallest "score" rows?

thanx

solex
 
perhaps it's then

"SELECT * FROM users ORDER BY score DESC"


DESC=descending
ASC=ascending
 
"SELECT * FROM users ORDER BY score"

Is good but I'm not sure what way it will be ordered. I usually specify ASC (ascending - lowest to highest) and DESC (descending - highest to lowest) to determine the order. so it would look like

"SELECT * FROM users ORDER BY score ASC"
 
Sorry, didn't mean to post an answer to a question that has been answered. hos2 posts quicker than I do :) I should learn to make my answers shorter
 
If left off, DESC or ASC the default will be ASC... per SQL standards.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top