mysql database does not store complete number of memberId

43 views Asked by At

Hi Im facing quite an odd problem

Users log in to my website via FB, the member nr is quite a lengthy nr looking something like this 10153852694717081.

When user does a transaction im noticing that only part of the member_id gets stored, the first 8 digits of member_id, in the table.

Could this be because the member number is to long? Any other suggestions why this is happening or any fixes that can be applied to work around this problem

Characteristics of member_nr row:

type=varchar

length = 255
3

There are 3 answers

0
Jeremy C. On BEST ANSWER

Facebook uid's don't have a set length, therefore there is no way to know how big to set your table so set your column type to an unsigned bigint, how to do this in phpmyadmin is like this: enter image description here

0
Vhortex On

MySQL can only store values up to the max length provided, the rest will be trimmed out. Be sure that your MySQL field have enough space to store the value to avoid truncation.

0
Isaac Bennetch On

Is this really a number (in the data type sense)? Sure, it's got digits in it, but it looks to me like this is better stored as a VARCHAR than an INT. If you're not doing arithmetic operations on it, I suggest using VARCHAR. That helps you out with the length limit, just set the VARCHAR length to a sufficient size.