3 Replies Latest reply on Jul 10, 2008 5:29 AM by (Purple_Edge)

    [MySQL+PHP] recordset: hot to show only NON-empty columns?

      Hi all,
      I have to create a recordset on a large mysql table.

      Is there a way to show only the resulting NON-empty columns?

      TIA

      tony
        • 1. Re: [MySQL+PHP] recordset: hot to show only NON-empty columns?
          Günter Schenk Level 4
          Hi Tony,

          just filter by IS NOT NULL in the WHERE clause, example:

          SELECT * FROM tablename WHERE columnname_one IS NOT NULL AND columnname_two IS NOT NULL

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: [MySQL+PHP] recordset: hot to show only NON-empty columns?
            Level 1
            >Hi Tony,
            >
            >just filter by IS NOT NULL in the WHERE clause, example:
            >
            >SELECT * FROM tablename WHERE columnname_one IS NOT NULL AND columnname_two IS NOT NULL
            >
            >Cheers,
            >Günter Schenk
            >Adobe Community Expert, Dreamweaver

            Hi Günter,
            I tried what you said but the column shows always, even if it's empty.

            Example:

            mytable is:

            field1 field2 field3
            1 uyiyo
            2 sdghjklfd
            3 dsgjklhfds
            4 dsghljkjlhdsfghdsgf

            Using the WHERE ... iS NOT NULL....
            I get this:

            field1 field2 field3
            1 uyiyo
            2 sdghjklfd
            3 dsgjklhfds
            4 dsghljkjlhdsfghdsgf


            Here is what I would like to show on my page:

            field1 field3
            1 uyiyo
            2 sdghjklfd
            3 dsgjklhfds
            4 dsghljkjlhdsfghdsgf

            I would like to do this on very large table (approx 40 fields).

            Thanks again,

            tony
            • 3. Re: [MySQL+PHP] recordset: hot to show only NON-empty columns?
              Level 1
              Maybe the editor is corrupting what you are trying to show, but I don't understand what you want? What are 1, 2, 3, and 4? Can you quote a practical example of what you want, as described I don't think it is possible?

              Here is what I would like to show on my page:

              field1 field3
              1 uyiyo
              2 sdghjklfd
              3 dsgjklhfds
              4 dsghljkjlhdsfghdsgf