Incorrect Integer (2147483647) is inserted into MySQL?

Archey picture Archey · Apr 21, 2012 · Viewed 58.5k times · Source

Alright, so I've been toying around with the Steam Web API, I have one of the values stored in a variable called $steam64. When I use this code snipper to INSERT it into a mysql database it insert a completley different integer than what is stored in the variable.

$sql_query = "INSERT INTO users_info (steam64) VALUES ('$steam64')";

var_dump($steam64); returns the real int, so does echoing it. Not too sure what is going on here, any help is appreciated.

Answer

George picture George · Jul 22, 2013

2147483647 is the largest int value for mysql. Just change the type from int to bigint.