unidox Posted June 19, 2007 Share Posted June 19, 2007 How do I sort a list alphabetically? Quote Link to comment https://forums.phpfreaks.com/topic/56144-order-by/ Share on other sites More sharing options...
hackerkts Posted June 19, 2007 Share Posted June 19, 2007 ORDER BY column ASC/DESC Quote Link to comment https://forums.phpfreaks.com/topic/56144-order-by/#findComment-277322 Share on other sites More sharing options...
teng84 Posted June 19, 2007 Share Posted June 19, 2007 Pls read some tutorial about php my sql ur question is very basic any ways: order by fieldname desc; order by fieldname: //ascending by default Quote Link to comment https://forums.phpfreaks.com/topic/56144-order-by/#findComment-277325 Share on other sites More sharing options...
cooldude832 Posted June 19, 2007 Share Posted June 19, 2007 teng proper use is all caps ORDER BY fieldname ASC or DESC Quote Link to comment https://forums.phpfreaks.com/topic/56144-order-by/#findComment-277328 Share on other sites More sharing options...
cooldude832 Posted June 19, 2007 Share Posted June 19, 2007 also ASC is not default its default in the initial php setup, but to say its default is a misinterpretation of the open sourceness of php. Not to be busting your chops, but if you gonna shot someone down do it right Quote Link to comment https://forums.phpfreaks.com/topic/56144-order-by/#findComment-277330 Share on other sites More sharing options...
neel_basu Posted June 19, 2007 Share Posted June 19, 2007 How do I sort a list alphabetically? I am confused with your Question. Do you wanna sort an array Alphabatically ?? Use sort() to do that. Quote Link to comment https://forums.phpfreaks.com/topic/56144-order-by/#findComment-277334 Share on other sites More sharing options...
teng84 Posted June 19, 2007 Share Posted June 19, 2007 oopss sorry!!! i just dont want to have my typing more complicated any way it will aslo work but your right all caps is the right way and i also dont use small caps that is hard to debug if complicated query is being debug. also ASC is not default its default in the initial php setup, but to say its default is a misinterpretation of the open sourceness of php. Not to be busting your chops, but if you gonna shot someone down do it right what do you mean ^^^ when you type order by in mysql it is ordering ascending then??? Quote Link to comment https://forums.phpfreaks.com/topic/56144-order-by/#findComment-277335 Share on other sites More sharing options...
cooldude832 Posted June 19, 2007 Share Posted June 19, 2007 sort() is a function for arrays already defined ORDER BY is a flag for a MySQL query of the SELECT type. yes you can sort your results post gathering from MySQL however it becomes a bigger challenge than doing it in query. This is because you are gathering 0->n rows where n is an integer values equal to the number of results matching the WHERE criteria of the query. In essence you develop a pseudo dual-deminsonal array which becomes a pain to sort because it doesn't have the proprietary key set to which MySQL field you would like thus making sort a big function that is not needed if you sort in query. Quote Link to comment https://forums.phpfreaks.com/topic/56144-order-by/#findComment-277339 Share on other sites More sharing options...
neel_basu Posted June 19, 2007 Share Posted June 19, 2007 How do I sort a list alphabetically? I am confused with your Question. Do you wanna sort an array Alphabatically ?? Use sort() to do that. I meant. I didn't understand wheather he was trying to sort an Array or MySQL results. as his Subject focuses on MySQL and his posts Focuses on Array Sortings. Why unidox is not repling ?? Quote Link to comment https://forums.phpfreaks.com/topic/56144-order-by/#findComment-277345 Share on other sites More sharing options...
cooldude832 Posted June 19, 2007 Share Posted June 19, 2007 not trying to brag/nag on you, but php is open source someone out there can mod up php and make their own php 6 if they wanted. Every part of php can be redefined by you the programmer and for big uses and code optimization you can set stuff like default ORDER BY or default sort() stuff like that. There are some practical uses like if you are always sorting by DESC then you can set DESC as default for that 5 byte code optimization Quote Link to comment https://forums.phpfreaks.com/topic/56144-order-by/#findComment-277347 Share on other sites More sharing options...
hackerkts Posted June 19, 2007 Share Posted June 19, 2007 Don't argue because of cap or not.. Just wait for the thread starter to reply.. Quote Link to comment https://forums.phpfreaks.com/topic/56144-order-by/#findComment-277351 Share on other sites More sharing options...
teng84 Posted June 19, 2007 Share Posted June 19, 2007 cooldude832 looks like where at the wrong way you were talking about array and i talk about sql in just thought it is my sql for seing those key word like you said ORDER BY need to be caps so i think thats sql any way am i wrong for saying that default is ascending in order by clause ????? YYYY????? Quote Link to comment https://forums.phpfreaks.com/topic/56144-order-by/#findComment-277355 Share on other sites More sharing options...
cooldude832 Posted June 19, 2007 Share Posted June 19, 2007 I'm just trying to make sure everyone understands the power of MySQL and php. Hopefully it will prevent a future question of can i change my default mysql ORBER BY direction there is a reason its open source and more widespread than asp Quote Link to comment https://forums.phpfreaks.com/topic/56144-order-by/#findComment-277358 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.