[thelist] Setting a MySQL value to NULL using PHP

John Corry webshot at members.evolt.org
Tue Apr 30 16:47:00 CDT 2002


> >NULL should be 'NULL', incidentally...
>
> I think this is mistaken. Null and 'Null' are not the same. The first is
> Null or absence of data. The second is a string with the letters N-u-l-l.

Oh...gosh, sorry.

I should have qualified my post with <warning>I'm a php/mysql
newbie</warning>

In all the examples I've ever seen, update query values are in single
quotes.

So, after reading this, I tried updating a column (null values allowed,
default value of ''):
UPDATE orders SET ordRec = NULL

That worked, the fields in that column now have a value of NULL, in
PHPMyAdmin they are displayed as <i>NULL</i>

I guess you have to watch for type conversion from NULL to '0'.

thanks Anthony and Rudy :)

John




More information about the thelist mailing list