clankill3r Posted June 8, 2011 Share Posted June 8, 2011 I get a "query failed: Out of range value" error, this is the value: 15660018291 what i only don't get is that tweet_id has a int type of 30 (as in int(30)). The id to add is only 11 long.. $twitter_id fleuragemapvv $tweet_id 15660018291 $tweet Reactie op Klink in opinieartikel in Volkskrant morgen $reply_to_id $date 2010-06-08 00:22:21 query failed: Out of range value for column 'tweet_id' at row 1 INSERT INTO tweets VALUES (NULL, 'fleuragemapvv ', '15660018291', 'Reactie op Klink in opinieartikel in Volkskrant morgen', '', '2010-06-08 00:22:21') Link to comment https://forums.phpfreaks.com/topic/238815-query-failed-out-of-range-value/ Share on other sites More sharing options...
Maq Posted June 8, 2011 Share Posted June 8, 2011 Please refer to the manual - http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html INT signed - 2147483647 unsigned - 4294967295 Link to comment https://forums.phpfreaks.com/topic/238815-query-failed-out-of-range-value/#findComment-1227123 Share on other sites More sharing options...
clankill3r Posted June 8, 2011 Author Share Posted June 8, 2011 thanks that worked one more thing, often the $reply_to_id is not set, however that seems to give problems when i want to insert it in the database now i tried this: if($reply_to_id == ""){ $reply_to_id = NULL; } but that don't work either. I also tried it with setting the default value for $reply_to_id in the database to NULL. So how can this be fixed? Link to comment https://forums.phpfreaks.com/topic/238815-query-failed-out-of-range-value/#findComment-1227149 Share on other sites More sharing options...
Maq Posted June 9, 2011 Share Posted June 9, 2011 To check if a variable isset use isset. You are checking if the variable is empty, which is not the same. Can you post the table structure? Link to comment https://forums.phpfreaks.com/topic/238815-query-failed-out-of-range-value/#findComment-1227475 Share on other sites More sharing options...
clankill3r Posted June 9, 2011 Author Share Posted June 9, 2011 Link to comment https://forums.phpfreaks.com/topic/238815-query-failed-out-of-range-value/#findComment-1227484 Share on other sites More sharing options...
Maq Posted June 9, 2011 Share Posted June 9, 2011 Set the column DEFAULT to NULL if that's what you want when $reply_to_id is not set. Link to comment https://forums.phpfreaks.com/topic/238815-query-failed-out-of-range-value/#findComment-1227489 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.