NamePros.Com (http://www.namepros.com/)
-   Programming (http://www.namepros.com/programming/)
-   -   PHP/MySQL: How to sort with custom rank settings (http://www.namepros.com/programming/496854-php-mysql-how-sort-custom-rank.html)

AzN 07-25-2008 11:35 PM

PHP/MySQL: How to sort with custom rank settings
 
How to sort with custom ranks?

Ex: I have 1 2 3 4
And I want to update the ranks to 1 3 2 4, how would I update this?

Using move up and down?

Thanks,
AzN

Peter 07-26-2008 05:33 AM

how are they stored? How are you determining which order they should be in?

nasaboy007 07-26-2008 08:48 AM

well you should have a key field with ID and then probably another field of "rank" which are numbers which you probably update manually or whatever.

just add ORDER BY rank ASC at the end of your sql statement and it'll order them for you. don't bother moving the entries aruond, cuz that'll take wayyy too many resources, especially if u get a large db.



edit: actually, after rereading your post, i think the proper sql command you're looking for is UPDATE. make sure you have a primary key field of id which autoincrements or w/e and then u can do an UPDATE command. google the exact syntax, i never get it perfectly right...


All times are GMT -7. The time now is 02:34 PM.
Site Sponsors
Advertise your business at NamePros

Powered by: vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0