Checking for "NULL" this way will result in a string comparison as the parameters are injected as prepared statements. You should use IS NULL.