I am getting the oddest trouble with something altering after i place it to some MYSQL table.

To a Wordpress theme.

Here's the gist from the code:

$user_id = $_COOKIE['user-id'];

The kind of the 'user_id' area of $custom_table is int(15).

I am presently testing on myself. The consumer id saved during my cookie is 4022466561291. It's being saved within the database as 2147483647.

I have also attempted various mixtures of this setup:

$user_id = intval($_COOKIE['user-id']);

with similar results.

Any ideas?

That's because 2147483647 is the maximum value of the signed 4-byte INT.

You should utilize a 8-byte BIGINT or - maybe appropriate here - a VARCHAR.

The (15) following the INT is a little misleading. It's a optional display length limitation only. It does not alter the actual capacity from the data type.

int won't hold that large of the value. You can test bigint. Begin to see the MySQL documentation

Take a look here: http://dev.mysql.com/doc/refman/5.1/en/numeric-types.html

The utmost for int is 2147483647, use bigint.

In the MySql Manual


An ordinary-size integer. The signed range is -2147483648 to 2147483647. The unsigned range is to 4294967295.

The (15) in your INT may be the recommended display width, and does not make an INT hold bigger amounts. You'll need a BIGINT.