Forums
This topic is locked
Select Order for Results
Posted 28 Dec 2005 19:41:24
1
has voted
28 Dec 2005 19:41:24 Matt Millican posted:
Hi there,I'd like a way to decide how results will appear on the page based on what the admin of the site has set. What I have so far is that one field in the database has a number in it. One of the records starts at one and they increase for each record there is. Then in the site admin, I have a page where it lists all of the records and then has a select box on each one, with the numbers starting at 1 and going to how ever many records there are. My question is how would you get each record to change down one say if you wanted take record #9 and move it to record #2's position(how would you change the rest of the ones after #2)?
Then the next question is, how would you update all the records at once using a UPDATE statement.
Thanks for any help you can give. It is greatly appreciated!
Matt
Matt Millican
InternetMill.com
www.internetmill.com
(XP Pro / Dreamweaver MX / Access XP Pro/ MS SQL / ASP / VB Script / PHP, mySQL / Photoshop / Fireworks)
Replies
Replied 31 Dec 2005 04:28:19
31 Dec 2005 04:28:19 Javier Castro replied:
I'm not an expert on the subject but I tried doing something similiar and what I did was to create an extra field that I could use to set the order in which I wanted to display my records. since the record ID is set by the DB and it is autonumber, you can set the new field called "displayorder" as numeric and plug in your numbers at your leasure and when you create your SQL select ORDER BY displayorder ASC or DESC and since you have set the order you want it should work nicely, I think.
Good luck,
Javier
Edited by - am7555 on 31 Dec 2005 04:44:05
Good luck,
Javier
Edited by - am7555 on 31 Dec 2005 04:44:05