Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6920691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:10:49+00:00 2026-05-27T10:10:49+00:00

I need to re-order via form submission rows in a table with the following

  • 0

I need to re-order via form submission rows in a table with the following structure for a nested page layout

Columns: (table name is: sourcedocs3)

sort1 | sort2 | type

1 | 1 | parent

1 | 2 | child

2 | 1 | no nesting

3 | 1 | parent

3 | 2 | child

3 | 3 | child

4 | 1 | no nesting

I need to be able to re-order (via PHP/Mysql) 3 to 1 without losing basic structure — 3 becomes 1 and all rows with value of 1 are incremented). Sounded simple but I’m having a hard time keeping the structure intact after shuffling (3|1 should be 1|1, 3|2 should be 1|2 etc)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:10:49+00:00Added an answer on May 27, 2026 at 10:10 am
    START TRANSACTION;
    
    UPDATE `why_do_people_never_give_the_table_name` SET sort1 = 999 
    WHERE sort1 = 3;
    
    UPDATE `why_do_people_never_give_the_table_name` SET sort1 = sort1 + 1 
    WHERE sort1 BETWEEN 1 AND 3
    ORDER BY sort1 DESC;
    
    UPDATE `why_do_people_never_give_the_table_name` SET sort1 = 1 
    WHERE sort1 = 999;
    
    COMMIT;
    

    Note that if you were moving a menu to a later position, e.g. moving 2 to 4, you’d want to order the second update in ASCending order.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to order by 2 columns using the entity framework. How is that
Hi I need a public order form to provide registered users in my site.
I am creating an online order form for multiple products. I need to calculate
I've written a simple order application that consists of a 1 page order-form containing
I'm submitting a form to my server via JavaScript in the view, in order
In Javascript I need to order objects in an array according to type. Each
The below shown is my query I need to order by with these three
I'm starting research on what I'd need in order to build a user-level plugin
I need to validate order of my output xml against a XSD using XMLUnit
I am trying to figure out what order I need to do everything to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.