Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Varchar issue on Mysql 2147483647

Tags:

mysql

varchar

Having the 2147483647 MYSQL issue.

When inserting an 11 digit number in the telephone field i am getting this number in return saved in the DB: 2147483647

TEL is set as VARCHAR not INT tough.

Also, on a database hosted on SERVER 1 i have the same exact database table and not having the same issue tough?! what might be?

This is the SQL and PHP

tel_no  varchar(20) utf8_general_ci  Yes    NULL
mob_no  varchar(20) utf8_general_ci  Yes    NULL

That's the MYSQL. Yes i am inserting an 11 digit number as string in the DB

$telno = GetValue($post['tel_no']);
$mobno = GetValue($post['mob_no']); 

$sql = "UPDATE ".$this->dbpre."bookings SET tel_no='$telno', mob_no='$mobno'...

Can you please help? I am getting crazy!

like image 710
Chris Zammit Avatar asked Jan 18 '26 11:01

Chris Zammit


1 Answers

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

like image 148
George Avatar answered Jan 21 '26 02:01

George



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!