Jump to content


Photo

Trouble with Queries


  • Please log in to reply
3 replies to this topic

#1 steve m

steve m
  • Members
  • PipPipPip
  • Advanced Member
  • 50 posts

Posted 18 April 2006 - 05:51 PM

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.


#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 19 April 2006 - 07:44 AM

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..
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 steve m

steve m
  • Members
  • PipPipPip
  • Advanced Member
  • 50 posts

Posted 19 April 2006 - 01:18 PM

Is there a way to change that? I'm not sure on hoe to do that.

#4 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 19 April 2006 - 01:42 PM

[!--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) View Post[/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.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users