Jump to content

Archived

This topic is now archived and is closed to further replies.

steve m

Trouble with Queries

Recommended Posts

I'm not really sure if this is a PHP or MySQL question. We recently upgraded to PHP 5 and the newest version of MySQL. I think I figured out most of the setups, but for some reason if we try to submit a form either to UPDATE or to INSERT data in to the database, it would come back with an error saying, "Cannot execute Query". Through some checking I found out that if a form had some blank fields during the submission process the query would fail. This never happened when we used the previous versions of MySQL and PHP. In certain cases, we need to be able to submit forms with blank fields. I checked the database to make sure that the fields that we are having problems with allow "NULL", they do. Am I missing a setting in my .ini files? Or is this something that is new where you can't submit blank fields anymore? I could really use some insight to this problem.

Thanks.

Share this post


Link to post
Share on other sites
This sounds like it has to do with MySQL 5's strict mode -- things like not being able to put blank strings into numeric columns, or invalid dates into date fields, etc..

Share this post


Link to post
Share on other sites
[!--quoteo(post=366402:date=Apr 19 2006, 08:18 AM:name=steve m)--][div class=\'quotetop\']QUOTE(steve m @ Apr 19 2006, 08:18 AM) [snapback]366402[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Is there a way to change that? I'm not sure on hoe to do that.
[/quote]
Well, [a href=\"http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html\" target=\"_blank\"]this refman page[/a] discusses the various modes in gory detail. You probably just need to add the appropriate mode to your my.cnf file -- the one that emulates MySQL 4.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.