Skip to main content
Topic: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column (Read 6469 times) previous topic - next topic

SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column

Field length in db is 45 characters. Entered value during test is 8 characters. Still I get the below error. Please help. See the attachment too.

http://localhost/ft1/<br /><b>Fatal error</b>:  Uncaught PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'password' at row 1 in C:/xampp/htdocs/ft1/app/models/PDODb.php:395Stack trace:#0 C:\xampp\htdocs\ft1\app\models\PDODb.php(395): PDOStatement->execute()#1 C:\xampp\htdocs\ft1\app\models\PDODb.php(1118): PDODb->buildInsert('users', Array, 'INSERT')#2 C:\xampp\htdocs\ft1\app\controllers\IndexController.php(138): PDODb->insert('users', Array)#3 C:\xampp\htdocs\ft1\system\Router.php(184): IndexController->register()#4 C:\xampp\htdocs\ft1\system\Router.php(211): Router->run('index/register')#5 C:\xampp\htdocs\ft1\index.php(83): Router->init()#6 {main}  thrown in <b>C:\xampp\htdocs\ft1\app\models\PDODb.php</b> on line <b>395</b><br />

Re: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column

Reply #1
The Password Field should be at least 300 Varchar. This is due to PHP BCRYPT Hashing of the password string.
PHPRad does not store passwords in plain text.

So you should increase in your password character length.

Regards