MySQL Error Creating Record: Field doesn't have a default value
3 posts by 2 authors in: Forums > CMS Builder
Last Post: March 4, 2011 (RSS)
By rentittoday - March 2, 2011
Hello,
We are having an issue with our sign up form. I found this post: http://www.interactivetools.com/iforum/gforum.cgi?post=79185; which seems like a similar problem as ours but still could not resolve the issue using the methods they provided. I know it is something simple that we must be missing.
We have a sign up form (sign_up.php, outisde of CMS) for users to setup their account. We have recently added a new checkbox field in CMS called 'rit_seal'. It is an admin only field, default state is unchecked, unchecked value = No, checked value = Yes. Now when a user tries to sign up, it returns the error below:
MySQL Error Creating Record:
Field 'rit_seal' doesn't have a default value
I tried to add a hidden field in the form, since we do not want users to be able to check or uncheck this box but the value could still be sent to CMS but I still get the same error.
Any help would be greatly appreciated!
We are having an issue with our sign up form. I found this post: http://www.interactivetools.com/iforum/gforum.cgi?post=79185; which seems like a similar problem as ours but still could not resolve the issue using the methods they provided. I know it is something simple that we must be missing.
We have a sign up form (sign_up.php, outisde of CMS) for users to setup their account. We have recently added a new checkbox field in CMS called 'rit_seal'. It is an admin only field, default state is unchecked, unchecked value = No, checked value = Yes. Now when a user tries to sign up, it returns the error below:
MySQL Error Creating Record:
Field 'rit_seal' doesn't have a default value
I tried to add a hidden field in the form, since we do not want users to be able to check or uncheck this box but the value could still be sent to CMS but I still get the same error.
<input name="rit_seal" type="hidden" id="rit_seal" value="No">
I know we have had issues in the past with checkbox values begin "1" or "0" despite the value specified in CMS so I also tried <input name="rit_seal" type="hidden" id="rit_seal" value="0">
also to no avail.Any help would be greatly appreciated!
Jason Glass
Re: [rentittoday] MySQL Error Creating Record: Field doesn't have a default value
By Jason - March 3, 2011
Hi,
There are a couple of ways to get around this. If you want to give this field a default value when creating a record, you can do this directly in your mysql insert query. A checkbox, for example, will have a value of either 1 or 0. so if you want to set it to be unchecked, you'd use this:
If you don't want to put a value into it through the insert query, you can turn off strict mode before you execute you're query.
Put this code above where you create your INSERT query:
Hope this helps
There are a couple of ways to get around this. If you want to give this field a default value when creating a record, you can do this directly in your mysql insert query. A checkbox, for example, will have a value of either 1 or 0. so if you want to set it to be unchecked, you'd use this:
rit_seal = '0',
If you don't want to put a value into it through the insert query, you can turn off strict mode before you execute you're query.
Put this code above where you create your INSERT query:
mysqlStrictMode( false );
Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Re: [Jason] MySQL Error Creating Record: Field doesn't have a default value
By rentittoday - March 4, 2011
It is all coming back to me now!
We have had to do this in the past and I totally overlooked it this time. :/
Thanks again!
We have had to do this in the past and I totally overlooked it this time. :/
Thanks again!
Jason Glass