JayDude Posted March 26, 2012 Share Posted March 26, 2012 I want to do an simple insert query, using a php form, insert a number reading. My problem is that when the database updates - the number that is entered differs substantially from what was entered in the form. The numbers can range from 1 to 99999: This is the table field that I have created (maybe the problem lies with the "smallint(6)") 3 diesel_dip_reading_value smallint(6) No None Following is a snipped of the php script: <p> <div class='field'> <label for='$diesel_dip_reading_value'>Dip Reading:</label> <input type='text' name='diesel_dip_reading_value' id='diesel_dip_reading_value' size='15' maxlength='15' /></div> </p> Quote Link to comment Share on other sites More sharing options...
cpd Posted March 26, 2012 Share Posted March 26, 2012 No None isn't SQL. I think your looking for NOT NULL. With regards to your problem you can't use a smallint for a value greater than 32,767 as a smallint is a signed 16-bit integer meaning it can be negative and in the range of -32,768 to +32,767. It's impossible for it to hold a value of 99,999 because there aren't enough bits. You require a minimum of "int". Quote Link to comment Share on other sites More sharing options...
JayDude Posted March 26, 2012 Author Share Posted March 26, 2012 Thank you very much, changing the smallint(6) to an int(7) sorted my problem. 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.