Page 1 of 1

Id problem

Posted: Sat Sep 10, 2011 8:09 pm
by Andrew
Hey I've got a strange problem with my register page. When I press register it says thanks for register......etc. but when I go inside my database it hasn't set any id for the newplayer, I mean after the other players if you know what I mean. If there's 2 players already it doesn't set any id on it. Just "0"

Hope you know what I mean.

Thanks
Andrew

Re: Id problem

Posted: Sat Sep 10, 2011 9:34 pm
by Jackolantern
Are you sure you set it to automatically increment, and set it as the table key? 0 is the default value, so it isn't being incremented. After you make sure it is set to automatically increment, make sure you aren't setting a value to it, and, in fact, aren't referencing the column at all in your INSERT statements. You just pretend that column doesn't even exist when adding new records.

Re: Id problem

Posted: Sun Sep 11, 2011 12:30 am
by Chris
It must be the Primary key as well.

Re: Id problem

Posted: Sun Sep 11, 2011 12:49 am
by Jackolantern
Yeah, that is what I meant. I can't remember, are there kinds of keys besides Primary?

Re: Id problem

Posted: Sun Sep 11, 2011 2:38 am
by begood
Yes there are, Primary, Index and Single (I'm not short if that's the names of phpmyadmin English version...)

Re: Id problem

Posted: Sun Sep 11, 2011 3:21 am
by Jackolantern
Weird lol. I have never had any use for any of them besides Primary. Thanks, though!

Re: Id problem

Posted: Sun Sep 11, 2011 1:44 pm
by Xaleph
PK`s usualy also have the UNIQUE attribute. Which is another index you can use.