How do I store a BIGINT in MySQL using PDO?

Viewed 3635

I know this question has been asked more than once here, but I couldn't find a solution.

We are using a database where we are storing the facebook id as a BIGINT(20).

create table users(
     fb_id bigint(20) NOT NULL,
     user_name varchar(30) NOT NULL,
     CONSTRAINT uk_name unique (user_name), 
     CONSTRAINT pk_fb_id primary key (fb_id)
)ENGINE=INNODB;

But the PDO engine of PHP can insert only the max integer value of PHP, i.e. 2147483647.

$stmt->bindParam(':fb_id', $this->fb_id, PDO::PARAM_INT);

This, I understand, is quite obvious since we are limited by the maximum value of integer in PHP. I tried to use the string -

$stmt->bindParam(':fb_id', $this->fb_id, PDO::PARAM_STR);

but still it doesn't work.

I want to know if there could be a workaround to store it as bigint.

1 Answers
Related