Jump to content

Problem with insert query


JayDude

Recommended Posts

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>

Link to comment
https://forums.phpfreaks.com/topic/259728-problem-with-insert-query/
Share on other sites

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".

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.