A mySQL NULL value and a PHP NULL value are not exactly the same thing and it may have something to do with the difference between the way NULLs are implemented in both. I think you’ll find that trying to compare to NULL within the SQL is where it will not work. I was assuming that the query was with regard to testing the field for NULL in the SQL itself.
:d’oh: of course. I’m too darn PHP-centric at times.
I tried finding info on FETCH without any luck (yet), but I did see documentation for queries like
Where field IS NULL
so the “IS” instead of the “=” is what to use for MySQL as far as NULLs are concerned.
FETCH is used where you have opened a cursor to hold the results of a query and you want to return the next record from the results in the cursor.
Either x IS NULL or ISNULL(x) should work to test if x contains null. I suppose which of them to use would depend on which fitted better with the way the surrounding SQL is coded. I wouldn’t expect it would make any difference to the efficiency of the processing (although I could be wrong as I have never actually tested it).