I am trying to make an update with a prepared statement, but it keeps updating the wrong value (2147483647). I can't figure out where this value is coming from. Here is my code:
$myID = 5;
$loginTokenNew = time() * rand(3, 33) * $myID;
$_SESSION['loginToken'] = $loginTokenNew;
$mysqli = connectToDB();
$stmt = $mysqli->prepare('UPDATE users SET token=? WHERE id=?') or die('Couldn\'t update user token');
$stmt->bind_param('ii', $loginTokenNew, $myID);
$stmt->execute();
$stmt->close();
$mysqli->close();
The weird thing is that the session variable takes the right value, but the "token field" in the db keeps taking the value: 2147483647
Is my prepared statement wrong somehow or could it have something to do with my db? the field "token" is a INT (255) field btw.