Take the 2-minute tour ×

I am using a facebook app to allow users to login to my website.

This works fine and it prompts the user to allow the app after they have entered there username and password.

As part of the sign in i submit some of the users info to a database to create a profile for them on my site. This works fine for 2 out of 4 of my test users and the correct info is saved to the database (name, email , id, ect..).

However my other two test users get the same ID number returned, which is different to the the ID numbers displayed in the Facebook API tool for there usernames.

So ignoring the two that work i will discuss my problem with the two that don't work below:

If i delete all entries from my database and login with account3 it is added to the database with the correct username, email address, name ect.. however its ID differs from that displayed in the facebook API tool. If i login with Account4 i get an error stating that there is a duplicate ID for id number This is how i have designed the code for the time being so i can debug this issue. If i delete the entry for account3 and sign in with account4 then it saves to the database with the correct name, email address, username ect but the ID number is still wrong.

Why would this work for 2 out of 4 accounts? And why would i be getting a duplicate ID error when all user ID's should be unique?

Any help would be great.

Thanks in advance.

share|improve this question
I have now solved this. Please see my answer below. –  andrew anderson Sep 7 '12 at 14:48
add comment

2 Answers

Facebook use int64 for id's, so using a double should be enough.

share|improve this answer
Thanks for the tip. –  andrew anderson Sep 7 '12 at 14:49
add comment
up vote 0 down vote accepted

having looked over this for sometime i have finally found the solution.

The ID is too long for the int field in mysql so it places the largest possible ID number.

I have changed the ID field to varchar(500) and my problem is resolved.

share|improve this answer
add comment

Your Answer


