2

The error message debug :

Database error in vBulletin 4.2.1:

Invalid SQL:

UPDATE user
SET post_thanks_thanked_times = post_thanks_thanked_times - 5,
    post_thanks_thanked_posts = post_thanks_thanked_posts - 1
WHERE userid = '3658';

MySQL Error   : BIGINT UNSIGNED value is out of range in 
               '(`forumsDb`.`user`.`post_thanks_thanked_times` - 5)'
Error Number  : 1690
Request Date  : Monday, February 24th 2014 @ 07:32:09 AM
Error Date    : Monday, February 24th 2014 @ 07:32:10 AM
Script        : http://domain.com/admincp/forum.php?do=kill
Referrer      : http://domain.com/admincp/forum.php?do=remove&f=5&s=
Classname     : vB_Database
MySQL Version : 5.5.35-cll

how can i resolve this problem ?

Thank you

Amarnath Balasubramanian
  • 9,300
  • 8
  • 34
  • 62
Achilles
  • 504
  • 2
  • 6
  • 16
  • 2
    Is the current value of `post_thanks_thanked_times` less than 5? – lc. Feb 24 '14 at 07:50
  • See here for [SQL Integer Types](http://dev.mysql.com/doc/refman/5.5/en/integer-types.html). Try to use a `BIGINT SIGNED` in case `post_thanks_thanked_posts` will be negative. – Leviathan Feb 24 '14 at 07:56

1 Answers1

2

You have to cast your value (Convert) to the proper type:

UPDATE user
SET post_thanks_thanked_times = CAST(post_thanks_thanked_times AS UNSIGNED) - 5,
    post_thanks_thanked_posts = CAST(post_thanks_thanked_posts AS UNSIGNED) - 1
WHERE userid = '3658';

More causes can be as a result of the same message, please check the answers on the post BIGINT UNSIGNED VALUE IS out of range My SQL

Community
  • 1
  • 1
Adel
  • 1,468
  • 15
  • 18
  • it's strange when i use the SELECT CAST(post_thanks_thanked_times AS UNSIGNED) + 1; i see error message : #1054 - Unknown column 'post_thanks_thanked_times' in 'field list' but i have this column ! – Achilles Feb 24 '14 at 08:05
  • new commands error : #1690 - BIGINT UNSIGNED value is out of range in '(cast(`sat0f_F0RuMs`.`user`.`post_thanks_thanked_times` as unsigned) - 5)' – Achilles Feb 24 '14 at 08:08
  • user is very general name for a table, could you rename your table to something else, this should conflict with the system reserved words... – Adel Feb 24 '14 at 08:09
  • 1
    Another point is that, it seems once you update with minus, your value is going to negative, and that would be one another cause, in this case try to change the field type from bigint to DECIMAL(10,2) – Adel Feb 24 '14 at 08:14
  • I've used SET sql_mode = 'NO_UNSIGNED_SUBTRACTION'; and then used that cmd , the problem has been solved . thanks – Achilles Feb 24 '14 at 08:24