I have a table where I have specified several columns which I have specified
that NULL values are not allowed.

I have created a PHP based create / update / delete page where users can
update the table.

I have an INSERT script that takes the user input and generates the
following query statement.


INSERT INTO table SET required_field = NULL

I have set the required field to NULL which results in an error because
naturally this is a required field.  If I use an actual value the query runs
fine and the row is added.

Now I have another page that allows the user to update the existing rows.


UPDATE table SET required_field = NULL WHERE id = '2'

This assumes that the user has cleared a required field and is attempting to
enter NULL data for a required field.  If I execute this directly in mysql
the query fails (0 rows touched).

If I execute this via PHP from the web page the row is updated but it passes
"" instead of NULL so the row is updated.  The query above is echoed right
from the web page and pasted into MySQL.

Any idea?



PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to