Error: Data isn't compatible with new type

2 posts by 2 authors in: Forums > CMS Builder
Last Post: about an hour ago   (RSS)

Hi Kenny,

The issue is that a checkbox column doesn't support the same data types as a text box. A text box stores NULL by default (or an empty string once you've saved content), but a checkbox only supports 1 or 0, never NULL. It's the same even if the text box had real content in it, since MySQL can't map arbitrary text to a number.

If the field is empty, the easiest fix is to just erase it and create the checkbox fresh. Or you can convert the existing values to 0 first:

UPDATE `your_table` SET `my_field` = 0 WHERE `my_field` IS NULL OR `my_field` = '';

Once the data in the column matches what a checkbox supports (in MySQL: tinyint unsigned NOT NULL), it should let you switch the type with no problem.

Hope that helps!  Let me know any questions.

Dave Edis - Senior Developer
interactivetools.com