473,386 Members | 1,708 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Id's being muddeled up!

6
Hi again, does anyone know how to make the automatic "ID's" in a table become synchronised again once something is deleted from the table.

I have a select list that holds the users ID whilst displaying the users user name. When the administrator clicks to delete the user the ID fields in the database table keep the same value i.e. an unordered value. The ID field in the database is set to automatic. I would like to know how to make it become an ordered list, any suggestions would be great.

If you need to see my code, i will post it.

Thank you.
Mar 17 '07 #1
1 1093
quill
12
Hi,

If you are using auto_increment and the id is relational to other tables, that could muck up a lot.

Say you had in a users table:

id | name
-------------

1 | Fred
2 | Joe
3 | Mary

And they each posted a message on a forum, so

id | userId | message
------------------------------
1 | 1 | Fred's message
2 | 2 | Joe's message
3 | 3 | Mary's message

If you deleted Joe from the users table and reordered the list so it looked:

1 | Fred
2 | Mary

Then Mary may be attributed to Joe's posts, so when you look up the forum posts it would be:

id | userId | message
------------------------------
1 | 1 | Fred's message
2 | 2 | Joe's message // But the userId would link to Mary (As she is now "2")
3 | 3 | Mary's message
// The userId "3" would not link anywhere, or someone else

If it is not related to anything, then you could do an export the data, empty the database and submit the data again, thus reordering the auto_increment.
Mar 17 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Neo Geshel | last post by:
I have an Access DB, from which I am going to pull images. Each image has an associated ID, but the ID's are not necessarily sequential (some images may have been deleted, leaving gaps in the list...
2
by: DC | last post by:
The Code <%@ import namespace="System" %> <%@ import namespace="System.Web" %> <%@ import namespace="System.Web.UI" %> <%@ import namespace="System.Web.UI.HtmlControls" %> <%@ import...
0
by: DC | last post by:
The problem I'm using the .NET GridView and FormView objects for the first time and im getting the error "An OleDbParameter with ParameterName '@ID' is not contained by this...
1
by: DC | last post by:
The problem I'm using the .NET GridView and FormView objects for the first time and im getting the error "An OleDbParameter with ParameterName '@ID' is not contained by this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.