3
votes

I am trying to push a lot of rows (400-2500) into a table using a single 'multiple insert' query (PHP's PDO Driver).

Now I get this error:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'customer_id' at row 1'

But as far as I can see, nowhere does it try to insert value 1264, especially not in the column customer_id. Also the amount of ?s in my prepared query matches the amount of items in the array that I pass to the execute() call.

if ((!in_array(true, $this->issuesCallsErrors)) && (substr_count($this->sql, '?') === count($this->issues))) {
    var_dump(substr_count($this->sql, '?')); //int: 3600
    var_dump(count($this->issues));          //int: 3600
    echo $this->sql;
    print_r($this->issues);

    $query = DBCon::getCon()->query('TRUNCATE TABLE `issue`');
    $query = DBCon::getCon()->prepare($this->sql);
    $query->execute($this->issues);

    ...

}

EDIT: Some extre info

The max value attempted to be inserted into customer_id is 193. customer_id is smallint(5), unsigned causing it to allow a max value of 65535 if I am not mistaken.

2

2 Answers

4
votes

1264 is not a value. It is error code. Maybe you try to insert customer_id value more then 2147483647.

2
votes

You can try to alter the table manually and change from "int" to "bigint" for the "customer_id"