SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'xxx' at row 1

671 Views Asked by At

I am using thinkCMF Chinees PHP framework for the backend and Vue for the front end.

I wanted to make an image upload optional and I removed it from the server required (Controller).

but submitting the form it was giving the above error.

I changed the column varchar(200) to varchar(500) but didn't work.

2

There are 2 best solutions below

0
On

We check the value of image upload in the front end. we make it optional from the front end then the issue is solved.

I was looking for a solution for a backend project but the solution was in a front-end project.

so the front team solved the problem.

1
On

try use text to replace varchar(200)