0

I'm currently experiencing a very illogical problem.

I'm using the CodeIgniter SQL query builder and I've written a SELECT query with this condition:

$sql->where("utm_source != 'WELCOMING'");

The problem is that if the utm_source column is NULL, it won't be returned. If I fill it with something random like "test", it'll be returned. I don't understand what's going on, this SQL query works perfectly locally, but it bugs in the staging server.

And MySQL versions are exactly the same in local and staging (5.7.35).

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Monsquid
  • 1
  • 1
  • 1
    If you want NULLs then add `or utm_source is null`; NULL means "unknown" and no value is equal or not equal to "unknown" – Stu Dec 30 '21 at 00:15
  • 1
    @Stu Thank you! It works now (I edited my post) – Monsquid Dec 30 '21 at 00:22
  • SO is a Q&A site, rather than a forum. As such, answers should be posted separately, not edited into the question. Please read the help center documentation on asking & answering, especially on how to [ask](//stackoverflow.com/help/how-to-ask) and [answer](//stackoverflow.com/help/how-to-answer) well. – outis Dec 30 '21 at 00:45

0 Answers0