Id problem

Need help with an engine or coding not on the list? Need help with a game or the website and forums here? Direct all questions here.
Post Reply
Andrew
Posts: 16
Joined: Mon Aug 15, 2011 12:57 pm

Id problem

Post 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
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Id problem

Post 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.
The indelible lord of tl;dr
User avatar
Chris
Posts: 1581
Joined: Wed Sep 30, 2009 7:22 pm

Re: Id problem

Post by Chris »

It must be the Primary key as well.
Fighting for peace is declaring war on war. If you want peace be peaceful.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Id problem

Post by Jackolantern »

Yeah, that is what I meant. I can't remember, are there kinds of keys besides Primary?
The indelible lord of tl;dr
User avatar
begood
Posts: 13
Joined: Fri Sep 09, 2011 11:23 am

Re: Id problem

Post by begood »

Yes there are, Primary, Index and Single (I'm not short if that's the names of phpmyadmin English version...)
Image
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Id problem

Post by Jackolantern »

Weird lol. I have never had any use for any of them besides Primary. Thanks, though!
The indelible lord of tl;dr
Xaleph
Posts: 897
Joined: Mon Feb 07, 2011 2:55 am

Re: Id problem

Post by Xaleph »

PK`s usualy also have the UNIQUE attribute. Which is another index you can use.
Post Reply

Return to “Advanced Help and Support”