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

  • Home
  • SEARCH
  • 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 8383839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:16:01+00:00 2026-06-09T17:16:01+00:00

I have a column called list which is used in my order by (in

  • 0

I have a column called list which is used in my order by (in MYSQL queries) and within list is numbers: (e.g. 1 to 20)

This list is then output using MYSQL order by list ASC – However, when I update my list in backend using a Jquery drag drop UI list it is supposed to update the list frontend.

My problem is that my list order sometimes conflicts with other rows as there could be two or three rows with the value of 1 in list therefore when my order updates I would like to know how I can update other rows by +1 only if the rows are >= the order number given

I do not want to make the column primary as I am not aiming to make the list column unique, the reason for this is because there is more than one category – and in each category they all start at 1 – therefore if I make it unique it would cause errors because there was multiple 1’s over different categories.

I asked a friend who said I could probably try PL/SQL using a trigger function but this is new grounds to me – I don’t fully understand that language and was wondering if anyone could help me do what I am trying to using MYSQL or even PL/SQL.

This is what I have so far:

<?php
$project = mysql_real_escape_string(stripslashes($_POST['pid']));
$category = mysql_real_escape_string(stripslashes($_POST['cat']));
$order = mysql_real_escape_string(stripslashes($_POST['order']));
// need to do update the moved result (list row) and update all conflicting rows by 1
mysql_query("UPDATE `projects` SET `cat`='$category',`list`='$order' WHERE `id`='$project'")or die(mysql_query());
?>

Conclusion:

I am trying to update a none unique column to have unique values for that individual category. I am not sure how to update all the rows in that category by +1

  • 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-06-09T17:16:03+00:00Added an answer on June 9, 2026 at 5:16 pm

    @andrewsi is right, in particular I suggest order by list ASC, last_update DESC so in the same query where you update list you can timestamp last_update and therefore you will have not need to use triggers or any other updates.

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

Sidebar

Related Questions

In mysql database i have this column called: Name: Date Type: datetime I have
I have this column called code that look like : 1-100-ETC-60 , 1-100-ETC-20 ,
I have a column called body , which contains body content for our CMS.
I have a column called menu_order which has no default value. When I select
I have a list of numbers in an Excel sheet. I.e . one column
I have a (one column) list called Test in R. When I view it
I have a column called DayShift in a table which is of Yes/No data
I have a table which has a column called lastUpdateTime, datetime type. How to
i have a column named name which is present in all tables in mysql
I have 2 tables. Table A has just one column called ID which has

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.