[thelist] Setting a MySQL value to NULL using PHP

rudy r937 at interlog.com
Tue Apr 30 22:27:01 CDT 2002

>... in everything else [NULL] is an evil monster
> waiting to rip your head off and cause you a lot of pain.

oh dear

if you are having pain, it is because you are letting the programming
language master you, rather than you mastering it

try using the COALESCE function to ensure that no nulls ever come back from
the database to your (inadequate) programming language to be misinterpreted

> Use simply 0, 1, or negatives if the situation fits.

respectfully, no, do not do this

"if the situation fits?" -- don't bother doing AVG() when you have a bunch
of 0's in there which really should be nulls

some situations *require* nulls for accuracy -- i.e. data integrity

with all due respect, you should embrace nulls, not run away from them


More information about the thelist mailing list