Out of range value

Discussion in 'MySQL' started by izlik, Jun 28, 2007.

  1. #1
    hello, im trying to use the Simpcms news script for my php page. but when the addons is installed etc i get this error "Out of range value adjusted for column 'id' at row 1" when trying to post anyting and was told it's my mysql side's problem and wonder if anyone knowwhy i could get this error ?

    the code bellow was all in "IF POST NEWS" in my admin.php file.

    /* IF POST NEWS ******************************************/
    if (isset($_POST[title]))
    {
    $_POST[text]=str_replace("'","\'",$_POST[text]);
    $news=mysql_query("INSERT INTO news(id,title,text,cat,tags,main,time) VALUES('','$_POST[title]','$_POST[text]','$_POST[cat]','$_POST[tags]','$_POST[main]','$time')") or die (mysql_error());
    echo "News Submitted<hr>";
    }
    /* IF POST NEWS ******************************************/
    PHP:
     
    izlik, Jun 28, 2007 IP
  2. gibex

    gibex Active Member

    Messages:
    1,060
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    95
    #2
    try change id column type , to a bigger int.
     
    gibex, Jun 28, 2007 IP
  3. izlik

    izlik Well-Known Member

    Messages:
    2,399
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    185
    #3
    how can i do that? im not 100% with mysql.
     
    izlik, Jun 28, 2007 IP
  4. UnrealEd

    UnrealEd Peon

    Messages:
    148
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    the problem isn't the max value of the integer field, but the STRICT_MODE setting of your mysql server. You're trying to insert an empty string '' into an INT field. If the STRICT_MODE is set to STRICT_MODE_TRANS, mysql will throw an error saying the value is out of range. You can change the strict mode by editing the my.ini or my.cfg file of your mysql server.
    If you don't have access to your sql server, you will have to alter your scripts
     
    UnrealEd, Jun 29, 2007 IP