SQL Constraint data too long for column 'name'

Avatar
  • Answered
2015-08-22 20:48:39:SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'name' at row 1

That is my error above.. Here is a little run through of my problem..
I use a wordpress plugin called Digital Access Pass, it allows me to protect my content towards certain memberships.. http://prntscr.com/87slkx

I made a post Test, and I was able to protect that post..
I made a post Top 5 Strong Safeties in Madden NFL 16 Ultimate Team, and I was unable to protect that post because I get the SQL error: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'name' at row 1


I have a good feeling it has something to do with one of the dap_ tables in PHPMyAdmin.. but I don't know which one, and I don't know how to increase the amount of characters a certain section can take.. I've never had this problem up until this year, since I switched over from BlueHost to InMotion.

my website: NewAgeMadden.com
Avatar
Scott
Hello,

Sorry to hear about your 1046 Constraint data too long for column 'name' error. This error is actually good and helps you to understand that you are trying to stuff too much data into a specific column.

For instance, if the 'name' column is only set to hold 50 characters and you are trying to give it a name with 75, then this is the result.

The error is due to the database being set in Strict mode. With strict mode turned off, MySQL will simply cut off any additional characters that you may need in the column. Using the same example as above, if you try to put a 75 character name in to a 50 character field, it will simply take the first 50 and drop the rest. This could be very bad if you are trying to store URLs or something else important. This could break many sites so the server is set to strict mode.

To fix your issue, you need to use phpMyAdmin and increase the size of the column in question (name). This way you can save the data you need to save in its entirety and not have it chopped thus losing precious data.

Kindest Regards,
Scott M