On 8 Mar 2002, at 15:52, Steve Buehler wrote:

> I have some fields set up in my MySQL database table as tinyint(5)
> The problem is that it will not except a NULL unless I specifically tell it 
> NULL.  I have a form that allows for input.  When submitted, it updates the 
> database.  If the field on the form is empty, it still puts a "0" (zero) 
> into that field in the database.

It sounds like you're just constructing the SQL to set the column to 
'', and the empty string (like any other nonnumeric string) gets 
converted to 0 when used for a numeric column.  You're going to have 
to check in your form-handling program for the case where the value 
is the empty string and then either set that column to NULL in your 
SQL or omit the column from the SQL entirely (assuming the default is 
NULL).

-- 
Keith C. Ivey <[EMAIL PROTECTED]>
Washington, DC

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to