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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.