View Full Version : Changing the order of rows in a DB with Classic ASP

12-04-2003, 02:42 PM
Im just wondering if theres a good way to like....move a certain row up or down in a database with ASP...

basically, waht i have is a news section on a page, but i'd like to give the admin the ability to change the order that the stories appear in...so like the top story would be "number 1" and then "#2" and so on and soforth...

just wondering if anyones seen anything that will allow me to give him the ability to bump "#4" up to "#1" ...etc...what would this involve?

if any of you are a member of Netflix....i got this idea from the Queue in Netflix....the way you can set the order of your items...

does this sound possible at all?

kasey aka robocop:thumbsup:

12-04-2003, 03:30 PM
I think that the more common way of doing this is not to alter the ordering of the data within the database, but to add a field that carries an "order" weighting. So you'd have something like:

SELECT * FROM news WHERE category='sports' ORDER BY orderField

and your admin section could allow people to change the ordering numbers; they don't even have to be consecutive or anything.

12-04-2003, 06:31 PM
what do you mean by "they dont have to be consecutive"...like i could have "1, 4, 5, 32, 42..." ?

anyone seen any scripts out there to do this?

thanks a million!