How do I read a MySQL data with a null field?

Discussion in 'Web Design' started by Glenn, Apr 1, 2016.

to remove all ads.
  1. Glenn

    Glenn Member

    Messages:
    192
    I have

    $pageSource = mysql_query("SELECT * FROM pmkArticles WHERE category = '$directory1'");



    I have a field where category is empty and if $directory1 is empty it does not read that field. Why?
     
  2. chrishirst

    chrishirst Well-Known Member Staff Member

    Messages:
    2,639
    Because an "empty" string is not NULL and NULL is not a "empty" string, in the same way that "empty space" does not equate to "Nothing" (with a capital N) to a theoretical physicist, so NULL is a special case of "nothing" to computer programmers.
     
  3. Glenn

    Glenn Member

    Messages:
    192
    So how do I get it to read them?
     
  4. chrishirst

    chrishirst Well-Known Member Staff Member

    Messages:
    2,639

Share This Page