I'm building a system for users to create/delete pages for a dynamic menu. One of the things I want to be able to do is have the user input a number (any integer) and have that number determine page order. The difficult comes when the user is trying to replace a page in the order. For example:
EXISTING:
Index (1)
Cheese Wiz (2)
Blue Cheese (3)
INPUT:
Cheddar Cheese (2)
now, the order of Cheese Wiz needs to be 3, and Blue Cheese needs to be 4.
Is there any way to increment several rows of data by one all at once? I really don't want to make several queries to update several different pages.
Insert order, increment other entries
Moderator: General Moderators
- jaoudestudios
- DevNet Resident
- Posts: 1483
- Joined: Wed Jun 18, 2008 8:32 am
- Location: Surrey
Re: Insert order, increment other entries
I think you will have to do multiple queries, but you could do an sql transaction - this will improve performance and will secure the system as if one query fails the whole system rollbacks (undo).