listing in several column, how?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Håkon Helgesen

    listing in several column, how?

    Hello!
    I am using php to get a result from a MySql Query, but the listing is too
    long to have in one column.

    Can i use CSS to get my result in several column?
    How?

    PS. This is the very first time I'm using css so be gentle (C:

    cheers
    Håkon Helgesen

  • Matthias Gutfeldt

    #2
    Re: listing in several column, how?

    Håkon Helgesen wrote:[color=blue]
    > Hello!
    > I am using php to get a result from a MySql Query, but the listing is
    > too long to have in one column.
    >
    > Can i use CSS to get my result in several column?
    > How?[/color]

    What kind of markup are you using for your 'listing' ? Tables, lists, ... ?


    Matthias

    Comment

    • Håkon Helgesen

      #3
      Re: listing in several column, how?

      Matthias Gutfeldt wrote:[color=blue]
      > What kind of markup are you using for your 'listing' ? Tables, lists, ... ?
      > Matthias[/color]

      I have been using table, but are open for suggestions if you have some tip.

      Håkon Helgesen

      Comment

      • Matthias Gutfeldt

        #4
        Re: listing in several column, how?

        Håkon Helgesen wrote:[color=blue]
        > Matthias Gutfeldt wrote:
        >[color=green]
        >> What kind of markup are you using for your 'listing' ? Tables, lists,
        >> ... ?
        >> Matthias[/color]
        >
        >
        > I have been using table, but are open for suggestions if you have some tip.[/color]

        OK, I didn't ask the right question :-). Is this tabular data, or just a
        list of items? Addresses, stock quotes, ... ?


        With tables you could e.g. spread the results over several columns, like
        this:
        _ _ _ _ _
        |a|1| |e|5|
        |b|2| |f|6|
        |c|3| |g|7|
        |d|4| |h|8|
        - - - - -

        Doesn't even require CSS, although of course you could / should omit the
        empty column and instead use CSS for a margin between the two sets of data.

        It's easier to make suggestions when we know a bit more about the kind
        of data you're working with!


        Matthias

        Comment

        • Håkon Helgesen

          #5
          Re: listing in several column, how?

          Matthias Gutfeldt wrote:[color=blue]
          > OK, I didn't ask the right question :-). Is this tabular data, or just a
          > list of items? Addresses, stock quotes, ... ?[/color]
          This is a list of items ( int(4) ) Wich comes from a mysql database.
          Here is the Sql sentence:

          $Select = "SELECT DISTINCT tabellnummer AS svar1 FROM skatt";
          Plane and simple.
          [color=blue]
          > With tables you could e.g. spread the results over several columns, like
          > this:
          > _ _ _ _ _
          > |a|1| |e|5|
          > |b|2| |f|6|
          > |c|3| |g|7|
          > |d|4| |h|8|
          > - - - - -[/color]

          Exactly!
          Only that I want only one item listed the same way.
          ________
          |1|5| 9|
          |2|6|10|
          |3|7|11|
          |4|8|12|
          ________
          [color=blue]
          > Doesn't even require CSS, although of course you could / should omit the
          > empty column and instead use CSS for a margin between the two sets of data.
          > It's easier to make suggestions when we know a bit more about the kind
          > of data you're working with![/color]

          I agree, but are not that good in explaining in English (C:

          cheers
          Håkon Helgesen
          css newbie

          Comment

          • Matthias Gutfeldt

            #6
            Re: listing in several column, how?

            Håkon Helgesen wrote:[color=blue]
            > Matthias Gutfeldt wrote:
            >[color=green]
            >> OK, I didn't ask the right question :-). Is this tabular data, or just
            >> a list of items? Addresses, stock quotes, ... ?[/color]
            >
            > This is a list of items ( int(4) ) Wich comes from a mysql database.
            > Here is the Sql sentence:
            >
            > $Select = "SELECT DISTINCT tabellnummer AS svar1 FROM skatt";
            > Plane and simple.
            >[color=green]
            >> With tables you could e.g. spread the results over several columns,
            >> like this:
            >> _ _ _ _ _
            >> |a|1| |e|5|
            >> |b|2| |f|6|
            >> |c|3| |g|7|
            >> |d|4| |h|8|
            >> - - - - -[/color]
            >
            >
            > Exactly!
            > Only that I want only one item listed the same way.
            > ________
            > |1|5| 9|
            > |2|6|10|
            > |3|7|11|
            > |4|8|12|
            > ________[/color]


            Unfortunately there is no property in CSS1 or CSS2 for multi-column
            display. CSS3 will have them, see <http://www.w3.org/TR/css3-multicol/>,
            but who knows when THAT one gets wide browser support.

            You know, why not use the good old Netscape 4 multicol element,
            <http://www.htmlref.com/reference/appa/tag_multicol.ht m>. It would work
            really well :-).

            I think the most widely supported solution would be to use a table, like
            you're doing now. You could use the PEAR HTML Table Matrix package
            <http://pear.php.net/package/HTML_Table_Matr ix> to make filling in the
            table a bit easier.


            Another solution would be to something like this:

            <p>01 02 03 04 05 06 07 08 09 10</p>
            <p>11 12 13 14 15 16 17 18 19 20</p>

            And then the CSS:
            p {width:1em; float:left; border:solid 1px black;}

            An example is here: <http://gutfeldt.ch/matthias/temp/list-of-thingies.html>

            But IMHO the table solution is better and makes more sense. Unless, of
            coursem you can convince yourself that "chunking" into blocks of 10 is
            justified.


            Matthias

            Comment

            • Håkon Helgesen

              #7
              Re: listing in several column, how?

              Matthias Gutfeldt wrote:[color=blue]
              > Another solution would be to something like this:[/color]
              [color=blue]
              > <p>01 02 03 04 05 06 07 08 09 10</p>
              > <p>11 12 13 14 15 16 17 18 19 20</p>[/color]
              [color=blue]
              > And then the CSS:
              > p {width:1em; float:left; border:solid 1px black;}[/color]
              [color=blue]
              > An example is here: <http://gutfeldt.ch/matthias/temp/list-of-thingies.html>[/color]
              This seems to be an good solution.
              Thank you so much!

              Cheers
              Håkon

              Comment

              • Brian

                #8
                Re: listing in several column, how?

                Matthias Gutfeldt wrote:
                [color=blue]
                > Another solution would be to something like this:
                >
                > <p>01 02 03 04 05 06 07 08 09 10</p>
                > <p>11 12 13 14 15 16 17 18 19 20</p>[/color]

                Those don't look much like paragraphs to me. How about using <div>
                instead? Here's a rough example of that, except instead of numbers, the
                data are thumbnails. (And, btw, the image urls and titles come from a
                MySQL database, too!)



                --
                Brian (remove ".invalid" to email me)

                Comment

                • Håkon Helgesen

                  #9
                  Re: listing in several column, how?

                  >> <p>01 02 03 04 05 06 07 08 09 10</p>[color=blue][color=green]
                  >> <p>11 12 13 14 15 16 17 18 19 20</p>[/color]
                  > Those don't look much like paragraphs to me. How about using <div>
                  > instead? Here's a rough example of that, except instead of numbers, the
                  > data are thumbnails. (And, btw, the image urls and titles come from a
                  > MySQL database, too!)[/color]
                  I did not work as i would anyhow (sorry)
                  My idea was to fill three column's by itselves.
                  If I have 32 results it uses two columns and if i have 45 results it fills
                  out three.
                  Is there a solutions in css that gives me fixed lenght of the column and
                  fill them up not more than 30 result in each?

                  Håkon Helgesen
                  sorry about the bad explaining



                  Comment

                  • Brian

                    #10
                    Re: listing in several column, how?

                    Håkon Helgesen wrote:
                    [color=blue]
                    > Brian wrote:[color=green]
                    >> Those don't look much like paragraphs to me. How about using <div>
                    >> instead? Here's a rough example of that, except instead of
                    >> numbers, the data are thumbnails. (And, btw, the image urls and
                    >> titles come from a MySQL database, too!)[/color]
                    >
                    > Is there a solutions in css that gives me fixed lenght of the column
                    > and fill them up not more than 30 result in each?[/color]

                    None that I can think of. The normal flow of a page is a series of block
                    boxes, inside of which are lines of text that flow left-to-right, or
                    right-to-left if the writing system or css proposes it.

                    There might be a solution for filling columns first, but it'd be very
                    complicated. My advice: stop wanting that, and accept that the
                    presentation will be different than you want, but still, well, acceptable.

                    --
                    Brian (remove ".invalid" to email me)

                    Comment

                    Working...