[thelist] Setting a MySQL value to NULL using PHP

John Corry webshot at members.evolt.org
Tue Apr 30 15:48:01 CDT 2002


I think this si an SQL problem. PHP is just a way to run a query against the
database, no different than if you did it from the command line, right?

NULL should be 'NULL', incidentally...

I just did a similar query from PHPMyAdmin where I tried updating a
'auto_increment' column, it said 'error: duplicate entry 0' which makes
sense.

Next I tried it on a column that is specified as 'not null' and has a
default value of '0'. The query updated the field to have a value of '0'.

Next I tried it on a column specified as 'null' (or, not 'not null') and
with a default value left blank. The fields were updated to have a value of
'0'.

It seems like 'NULL' will always put a value of '0' in a field...

Does that help?

John




More information about the thelist mailing list