Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

afoysal's avatar

Insert data in enum() field

I am trying to insert data through postman. My error is like below

"SQLSTATE[01000]: Warning: 1265 Data truncated for column 'salutation' at row 1 (SQL: insert into `students` (`salutation`, `fullName`, `nickname`, `studentId`, `email`, `DOB`, `maritalStatus`, `gender`, `blood_group`, `nationality`, `religion`, `mobileNumber`, `homePhone`, `officePhone`, `emergencyContactNumber`, `present_address`, `permanent_address`, `updated_at`, `created_at`) values (`Mr.`, mouse, hello, laptop, hello, 10/12/2001, Single, Male, A+(ve), dsfsd, 10, mobile, key, 123456, royak, m10, 10, 2019-05-30 10:09:16, 2019-05-30 10:09:16))"

My enum() field is like below

enter image description here

0 likes
7 replies
munazzil's avatar

You have to delete the entire table and add new table in your database, because have you delete the data in the table before.

1 like
munazzil's avatar

You mean you have to import the table and export the table it is not good idea you have to go with entire new table with all columns because the id itself save in there.

1 like
munazzil's avatar

Have you set enum() for string in database?

1 like
siangboon's avatar

@MUNAZZIL - please do not simply give irresponsible advice, your advice is very danger to others, deleting table due to an error is not make sense and it's super destructive action where the person may talking about production database, and may not have existing data backup. Please stop doing so or think twice or more before you reply.

@afoysal the issue may due to the data type defined in your table does not match with your value you gave. try copy the query or hard code the desired values and run it at query editor or sql command and fine tune it.

1 like

Please or to participate in this conversation.