Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 4 of 4

This is a discussion on MySQL error, null handling changed on integers?? in the General Hosting and Network Support forum
I am "suddenly" getting an error from MySQL on my server. Sometime between January 10 and January 15, inserts into a MySQL table are failing. ...

  1. #1
    Ron
    Ron is offline
    Loyal Client
    Join Date
    Aug 2002
    Posts
    7,304

    MySQL error, null handling changed on integers??

    I am "suddenly" getting an error from MySQL on my server.

    Sometime between January 10 and January 15, inserts into a MySQL table are failing.

    The code is very simple, as is the table. Here they are:

    Code:
    The insert statement:
    $sql = "insert into xxxxxxxxxx values ($rs_1111111111,$rs_2222222222,'')";
    Note that the double single-quote for the third column value is hard coded.
    
    The table create:
     CREATE TABLE `xxxxxxxxxxx` (
      `1111111111` mediumint(8) NOT NULL default '0',
      `2222222222` mediumint(8) NOT NULL default '0',
      `XXXXXXXXXX` tinyint(1) default NULL,
      KEY `3333333333` (`3333333333`),
      KEY `4444444444` (`4444444444`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1
    And the error message I get is pretty straightforward as well:
    Code:
    Incorrect integer value: '' for column 'XXXXXXXXXX' at row 1
    It had been working for over a year; hundreds of successful inserts.

    Now I understand why this might not be working, but what I want to know is what changed on the server to cause this to suddenly start failing? Has a new version of MySQL been installed in that timeframe? Is there a release notes page for that version that might explain the error? Was the server put into ANSI mode?

    Thanks.
    Last edited by Ron; 02-06-2012 at 02:08 PM.
    Good luck

  2. #2
    Loyal Client the_ancient's Avatar
    Join Date
    Feb 2004
    Posts
    3,384
    You may already know this, but

    PHP Code:
    $sql "insert into xxxxxxxxxx values ($rs_1111111111,$rs_2222222222,'')"
    should be

    PHP Code:
    $sql "insert into xxxxxxxxxx values ($rs_1111111111,$rs_2222222222,NULL)"
    I cant tell you what has changed, I believe there was some updates to PHP that might have effected the mysql drivers......
    -------------------------
    the_ancient
    MP Technology Group

  3. #3
    Ron
    Ron is offline
    Loyal Client
    Join Date
    Aug 2002
    Posts
    7,304
    Yes, I'm sure that's what it should be, and clearly how I should have written it, give or take. Clearly it was not the way I would have written it had I looked at the table defs. I probably copied some code from an old version of phpBB2.x or some hack for it.. I don't recall.

    Yes, you are correct, the question I have is -- what changed??

    Looking at MySQL docs, it could be the server was put into ANSI mode or strict trans tables or something like that, too. Or maybe it was a MySQL version change. I dunno. But something definitely changed.

    I've already coded around it, or more properly in this instance I've corrected my code to be proper to account for this change. But I'm used to doing that here whenever they break something of mine. Or in this case change something that highlights my bad code.

    THANKS for offering the suggestion, T_A
    Last edited by Ron; 02-06-2012 at 04:08 PM.
    Good luck

  4. #4
    Voluntarily Retired gohighvoltage's Avatar
    Join Date
    Jan 2011
    Posts
    641
    I am willing to bet the server was accidentally changed to Strict mode.


    By default, MySQL is enabled with strict_mode ON.

    So if they did an upgrade of some kind, this could of caused your issues.

    Do you have access to my.ini file?

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •