null is unknown. an empty, oops, placeholder. ok, I'll know it when I see it!
using null as a comparison, is pretty stoopid. 1 null has no relation to any other null.
null was created from relational dbs, to cover when no data exists, outside join like. SELECT * FROM user, type, WHERE user.id=type.id. What if you want all users, regardless of type?
... Then you'd use a left join, rather than an inner join (which BTW I think you did....)
I don't think you understand the point of doing if($var === NULL){....
It's to check if the variable is null so you know what to PUT in the placeholder. (There are other reasons but this is an obvious one.)