phpMyAdmin Autoindex Value

This is a discussion on "phpMyAdmin Autoindex Value" within the Databases section. This forum, and the thread "phpMyAdmin Autoindex Value are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Databases

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Mar 3rd, 2007, 15:04
New Member
Join Date: Nov 2006
Location: Washington
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
phpMyAdmin Autoindex Value

Hello, I created a database using myphpadmin, I have an ID field that gets an auto index value. Through testing and editing I have had to delete rows so my autoindex doesn't reflect the next real ID number, is there a way to change what the next value it will give for the next new entry?

Thanks,
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Mar 4th, 2007, 08:50
Ryan Fait's Avatar
Elite Veteran
Join Date: May 2006
Location: Las Vegas
Posts: 3,787
Thanks: 0
Thanked 0 Times in 0 Posts
Re: phpMyAdmin Autoindex Value

In mySQL, you can set the number to the lowest auto-increment number + 1. You cannot fill in numbers that no longer exist with only mySQL syntax, however. PHP or another mySQL programming aid can do this for you. At any rate, unless you're a neat freak, this shouldn't be a problem.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Mar 4th, 2007, 20:42
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: phpMyAdmin Autoindex Value

Although I use a different database admin tool, if you go into phpMyAdmin and click on the link for the table in question, you should find one of the tabs is labeled 'Empty'.

Clicking on this should let you empty the table when you have finished testing and reset everything including indexes back as if you had just set the table up.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Mar 6th, 2007, 11:16
masonbarge's Avatar
Highly Reputable Member
Join Date: Jan 2006
Location: Atlanta GA
Posts: 631
Thanks: 0
Thanked 0 Times in 0 Posts
Re: phpMyAdmin Autoindex Value

You cannot set a primary autoincrement key to a number that has been deleted. You have to do approximately what Geoff was suggesting (although myphpadmin works a little differently).

In Operations, you will see that you can copy the "structure only" of a table. Do that. Then copy all the values except the primary key, which will autoindex from 1 to n. Either change the name of the original or delete it, then rename the new table to the name you want.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Mar 7th, 2007, 19:05
Reputable Member
Join Date: Jul 2005
Location: Melksham, Wilts, UK
Posts: 293
Thanks: 0
Thanked 0 Times in 0 Posts
Re: phpMyAdmin Autoindex Value

Although your answers are perfectly valid, gents, shouldn't we be taking a step back from the original question here and asking why it's important that the ids are sequential / low starting for the questioner? As just a matter of interest, the question is a good one. But if a solution is based on the answer, then fixing it today will only be a temporary thing ... there will come other times that it needs to be reset, and a unique primary key column and a separate record ID might make more sense.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
autoindex, phpmyadmin

Thread Tools

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
phpMyAdmin geyids Databases 8 Aug 11th, 2007 07:03
My SQL/PHP - phpmyadmin mikes Databases 11 Jun 15th, 2006 14:44
phpmyadmin ktsirig PHP Forum 1 Sep 30th, 2005 10:06
phpmyadmin help needed blatant3 PHP Forum 1 Nov 4th, 2004 08:48


All times are GMT. The time now is 17:08.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42