steve m Posted April 18, 2006 Share Posted April 18, 2006 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. Link to comment https://forums.phpfreaks.com/topic/7750-trouble-with-queries/ Share on other sites More sharing options...
fenway Posted April 19, 2006 Share Posted April 19, 2006 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.. Link to comment https://forums.phpfreaks.com/topic/7750-trouble-with-queries/#findComment-28491 Share on other sites More sharing options...
steve m Posted April 19, 2006 Author Share Posted April 19, 2006 Is there a way to change that? I'm not sure on hoe to do that. Link to comment https://forums.phpfreaks.com/topic/7750-trouble-with-queries/#findComment-28558 Share on other sites More sharing options...
fenway Posted April 19, 2006 Share Posted April 19, 2006 [!--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. Link to comment https://forums.phpfreaks.com/topic/7750-trouble-with-queries/#findComment-28563 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.