Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
How do I fix this problem? PHP & PHPMyAdmin related?
Old 08-30-2010, 02:03 AM How do I fix this problem? PHP & PHPMyAdmin related?
Junior Talker

Posts: 1
Name: John Oliver
Trades: 0
I created a webpage that adds the following info in my database: ID and Name.I don't know how to explain exactly what I want to do but here it is.I set ID as Primary and check the auto increment for it.

I fill up the form containing Name in my webpage and let PHP handle it and do it three times with different values. The ID will be input automatically by auto incrementation.

Then I view it in PHPmyAdmin

1 Martin
2 Matthew
3 Michael

As you can see the autoincrementation handles the ID and in sequence. Now I delete the row with ID #2 so that leaves the row with ID # 1 and 3. Then I went back to my webpage to fill up again.Now here is my problem when I view it in the PHPmyAdmin

1 Martin
3 Michael
4 Matthew

How can I fix this? I want the new data to be inserted into gaps. Thanks
__________________
John Oliver

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
johnoliver is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-30-2010, 02:20 AM Re: How do I fix this problem? PHP & PHPMyAdmin related?
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
You can't, auto increment increments from the last value, you would have to determine the ID value and fill the gaps yourself and write it to database, without using auto increment. Are you trying to determine how many records are in the database? for that, use "count" operator.
__________________
Sleeping Troll, EMUSE, Mind Expansion...Truly serendipity!

Last edited by Sleeping Troll; 08-30-2010 at 02:22 AM..
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
Old 08-30-2010, 08:15 PM Re: How do I fix this problem? PHP & PHPMyAdmin related?
metho's Avatar
Ultra Talker

Posts: 481
Location: Gold Coast - Brisbane QLD, Australia
Trades: 0
Why do you want to 'fill the gaps'? If you need a sequential numbering system for human reference - then add one to your table and alter your scripts to check for 'gaps' and insert with an appropriate number value. However leave the ID alone; this is used for a database reference to a unique record in a table, more important than human reference.
__________________
I do
Please login or register to view this content. Registration is FREE
based.
Spend a lot of time in
Please login or register to view this content. Registration is FREE
.
And
Please login or register to view this content. Registration is FREE
chews up the rest.
metho is offline
Reply With Quote
View Public Profile Visit metho's homepage!
 
Reply     « Reply to How do I fix this problem? PHP & PHPMyAdmin related?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.20733 seconds with 12 queries