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
249 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 350 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
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 150 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

763 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