Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

o.k i have a problem, when i delet something from a table its idea number never comes back

Posted on 2008-06-09
8
Medium Priority
?
265 Views
Last Modified: 2010-04-21
o.k lets say i have a table named place1
and it have

id  -   place
1  -    idms
2  -    sds
3  -   dfdf
4 -    dffsf

and lets say i delet id number 4
and i insert onther field
dsfef
so now the table looks like that

id  -   place
1  -    idms
2  -    sds
3  -   dfdf
5 -    dsfef

so where number 4 went?

i want it
0
Comment
Question by:mgtm3
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 9

Expert Comment

by:Rob Siklos
ID: 21746358
If you want it, then don't delete it!
0
 
LVL 9

Accepted Solution

by:
michofreiha earned 1400 total points
ID: 21746387
In order to do that you should not make the id field autonumber...Put it as a number and the value of each new filed that you enter should be the greater value of id+1...This is the only solution
0
 

Author Comment

by:mgtm3
ID: 21746430
how do i do that michofreha?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 9

Expert Comment

by:michofreiha
ID: 21746484
1-change id type from autonumber to number or int and put it unique or set it as primary key for performance
2-Select max(id) from table
3-$var=max(id)+1
4-insert into table(id,place) values($var,'dsfef')

If it you don't know how to make it work I can build the complete code for you
0
 

Author Comment

by:mgtm3
ID: 21746574
thank uuuuuu
0
 
LVL 9

Expert Comment

by:michofreiha
ID: 21746584
did it work?
0
 
LVL 29

Assisted Solution

by:fibo
fibo earned 600 total points
ID: 21746629
The point is that not reusing deleted records IDs is useful in certain circumstances: that's why, if the field is "autoincrement" previous "free" values are not reused
Autoincrement does guarantee that every new record as a unique ID, which i s also unique "over time".

In most situations you don't need to worry for holes and "missing numbers": to make it short, it does not cost a cent!

So, if these homes are really a nuisance, spend some time to turn around them: the suggested solutions will be helpful for that; if they are not a nuisance... let them happen as they will!
0
 

Author Closing Comment

by:mgtm3
ID: 31465546
thankss
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question