PHP/SQL Help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ridikuloz
    Confirmed User
    • Jun 2005
    • 2080

    #1

    PHP/SQL Help

    What is the command to ignore empty values when you are queuering for results?

    So far people have told me "SELECT colname FROM tablename WHERE colname IS NOT NULL" but that does not work. Anyone here can help me?
    Each persons' level of stupidity makes us different.
  • wizzart
    scriptmaster
    • May 2006
    • 5246

    #2
    SELECT colname FROM tablename WHERE colname IS NOT 0

    NULL and 0 is not the same !
    BimboZone

    Comment

    • ridikuloz
      Confirmed User
      • Jun 2005
      • 2080

      #3
      nope doesn't work, gives me a syntax error.
      Each persons' level of stupidity makes us different.

      Comment

      • nestle
        Confirmed User
        • Apr 2006
        • 647

        #4
        Define what you mean by "ignore empty values". An empty value is simply '' (without single quotes).

        If your colname is defined by NOT NULL and is completely empty:
        SELECT colname FROM table WHERE colname != '';

        If your colname has a NULL value in it:
        SELECT colname FROM table WHERE colname <=> NULL;
        or
        SELECT colname FROM table WHERE colname IS NOT NULL;

        Comment

        • ridikuloz
          Confirmed User
          • Jun 2005
          • 2080

          #5
          yeah, empty values, nothing, nada, no "null" just plain empty values.
          Each persons' level of stupidity makes us different.

          Comment

          • ridikuloz
            Confirmed User
            • Jun 2005
            • 2080

            #6
            everything worked out, thanks alot!
            Each persons' level of stupidity makes us different.

            Comment

            • nestle
              Confirmed User
              • Apr 2006
              • 647

              #7
              Originally posted by ridikuloz
              everything worked out, thanks alot!
              No problemo, it's what I do.

              Comment

              Working...