twilitegxa Posted June 14, 2009 Share Posted June 14, 2009 I am getting this error when I submit my form: Out of range value adjusted for column Can anyone tell me how to fix this problem? Do you need to see the code to the form or php file? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted June 14, 2009 Share Posted June 14, 2009 You are attempting to put a value into a column that is greater than what the column definition permits. Assuming you have confirmed that the value is correct and expected, that would indicate that your column definition must be adjusted to accommodate the actual data value. Quote Link to comment Share on other sites More sharing options...
twilitegxa Posted June 22, 2009 Author Share Posted June 22, 2009 How can I fix this problem? I haven't changed the code and this code used to work just fine. It is for a discussion board and the value I'm having the problem with is, I think, the automatically entered number for the id. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted June 22, 2009 Share Posted June 22, 2009 So, as the number of posts increases, the value of the id increases. You were already told how to fix the problem - ...your column definition must be adjusted to accommodate the actual data value. Quote Link to comment Share on other sites More sharing options...
twilitegxa Posted June 22, 2009 Author Share Posted June 22, 2009 I don't understand what exactly I have to do to adjust the column definition. I have it set to int, which appears to only allow 11 characters. Is this what I change? What can I change it to? Quote Link to comment Share on other sites More sharing options...
fenway Posted June 27, 2009 Share Posted June 27, 2009 I don't understand what exactly I have to do to adjust the column definition. I have it set to int, which appears to only allow 11 characters. Is this what I change? What can I change it to? Since you haven't shown us (a) the table definition or (b) the value being adjusted, we can't say -- though int supports values up to ~2 billion (~4 billion if unsigned). Quote Link to comment Share on other sites More sharing options...
twilitegxa Posted July 13, 2009 Author Share Posted July 13, 2009 When I did the MySQL statement to create the table, I used this: create table forum_topics ( topic_id int not null primary key auto_increment, topic_title varchar (150), topic_create_time dattime, topic_owner varchar (150) ); create table forum_posts ( post_id int not null primary key auto_increment, topic_id int not null, post_text text, post_create_time datetime, post_owner varchar (150) ); And here is my code for adding the topic: <?php //check for required fields from the form if ((!$_POST["topic_owner"]) || (!$_POST["topic_title"]) || (!$_POST["post_text"])) { header("Location: addtopic.html"); exit; } //connect to server and select database $conn = mysql_connect("mysql5.webdesignsbyliz.com", "twilitegxa", "minimoon") or die(mysql_error()); mysql_select_db("smrpg",$conn) or die(mysql_error()); //create and issue the first query $add_topic = "insert into forum_topics (topic_title,topic_create_time,topic_owner) values ('".$_POST['topic_title']."', now(), '".$_POST['topic_owner']."')"; mysql_query($add_topic,$conn) or die(mysql_error()); //get the id of the last query $topic_id = mysql_insert_id(); //create and issue the second query $add_post = "insert into forum_posts (topic_id, post_text, post_create_time, post_owner) values ('$topic_id', '".$_POST['post_text']."', now(), '".$_POST['topic_owner']."')"; mysql_query($add_post,$conn) or die(mysql_error()); //create nice message for user $msg = "<P>The <strong>$topic_title</strong> topic has been created.</P>"; ?> <html> <head> <title>New Topic Added</title> </head> <body> <h1>New Topic Added</h1> <?php print $msg; ?> </body> </html> Right now, the topics and posts are not adding to the tables in the database, but the message is displaying saying that they are, but also this error displays: Notice: Undefined variable: topic_title in C:\wamp\www\do_addtopic.php on line 28 I am no longer receiving the error about the out of range adjusted value for column. I guess I fixed that somehow? Quote Link to comment Share on other sites More sharing options...
fenway Posted July 15, 2009 Share Posted July 15, 2009 That's a php error, not a mysql error. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.