mysql database. deleting..

C++, C#, Java, PHP, ect...
Post Reply
tomtefan
Posts: 46
Joined: Tue Jun 22, 2010 12:46 pm

mysql database. deleting..

Post by tomtefan »

I have deleted my test chars over and over. when ever i need to test regestering from start etc..

but, how can i set the ID back to 0 (zero).

when i start a char again, it says: id 79. 80 etc.
User avatar
Chris
Posts: 1581
Joined: Wed Sep 30, 2009 7:22 pm

Re: mysql database. deleting..

Post by Chris »

Code: Select all

ALTER TABLE `table` AUTO_INCREMENT =1
Fighting for peace is declaring war on war. If you want peace be peaceful.
User avatar
Callan S.
Posts: 2042
Joined: Sun Jan 24, 2010 5:43 am

Re: mysql database. deleting..

Post by Callan S. »

I was wondering that too! Thanks Chris! Is there a way to do that manually through phpMyAdmin as well?
Fight Cycle : My latest Browser game WIP
Driftwurld : My Browser Game WIP
Philosopher Gamer : My Blog
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: mysql database. deleting..

Post by Jackolantern »

Callan S. wrote:I was wondering that too! Thanks Chris! Is there a way to do that manually through phpMyAdmin as well?
It has been a while since I have used phpMyAdmin, but I know there is a way to type SQL queries directly into the GUI and execute them. I don't think I have ever had to use it before, but it would come in handy to perform that command manually.
The indelible lord of tl;dr
User avatar
Chris
Posts: 1581
Joined: Wed Sep 30, 2009 7:22 pm

Re: mysql database. deleting..

Post by Chris »

Yes there is.

Select your table. Then choose the 'Operations' tab along the top. Should be the 8th tab.

Then under Table options put 'AUTO_INCREMENT' to whatever you want.
Fighting for peace is declaring war on war. If you want peace be peaceful.
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: mysql database. deleting..

Post by hallsofvallhalla »

good info here
User avatar
Callan S.
Posts: 2042
Joined: Sun Jan 24, 2010 5:43 am

Re: mysql database. deleting..

Post by Callan S. »

Ah ha! Thanks Chris! Do you know what happens if you set it to a number already used? Does it overwrite the entry, or just keep looking until it finds an index that's empty? Just asking if you know, as I'd have to fiddle about alot (for me, atleast), to find out by experiment.
Fight Cycle : My latest Browser game WIP
Driftwurld : My Browser Game WIP
Philosopher Gamer : My Blog
User avatar
Chris
Posts: 1581
Joined: Wed Sep 30, 2009 7:22 pm

Re: mysql database. deleting..

Post by Chris »

I'm guessing it will throw an error. Not sure myself :P.
Fighting for peace is declaring war on war. If you want peace be peaceful.
tomtefan
Posts: 46
Joined: Tue Jun 22, 2010 12:46 pm

Re: mysql database. deleting..

Post by tomtefan »

hmm.. tried to delete (alter) the database manualy, but it doesnt work for me.

i put the auto increment to 1 (want the id to start from 1) and i press Go.

it loads up, and when its done it still shows the old id 86 (and rising).


I also tried to change it when i didnt have any characters in the table. still doesnt work / change for me.


any ideas ? :?


EDIT:
HMM, NOW it worked. weird. :lol:
Post Reply

Return to “Coding”