Data truncated for column ‘status’ at row 1 [SOLVED]

Recently I encountered the following error:

Data truncated for column ‘status’ at row 1

This was specifically in a PHP based web hotel/reservations app that uses MySQL for the database backend. When trying to add a new dropdown option value of ‘departed’, the form submission would always fail with the aforementioned error.

Thankfully, the solution was easy once I checked the table/field definitions. The column ‘status’ was of type enum and thus needed to have the ‘departed’ value specifically enumerated in the field definition.

Showing the existing enum values for the status field

Showing the existing enum values for the status field

After adding that new value to the table field, all was well:

Add 'departed' as a new enum value for the status field

Add ‘departed’ as a new enum value for the status field

After the table change was saved, the application worked perfectly. 🙂 I also added a note in the PHP source code so that if anyone else ever needs to add a value there, they will know that the underlying table definition needs to be updated as well!

Leave a Reply

Your email address will not be published. Required fields are marked *