Put data in rows made by 3 columns

Discussion in 'PHP' started by maleic, Jan 17, 2010.

  1. #1
    Hello,

    I need to put data in rows made by 3 columns.

    example

    data1 data2 data3
    data4 data5 data6
    data7 data8 data9
    data10

    Thanks in advance for help and attention.
    maleic
     
    maleic, Jan 17, 2010 IP
  2. CodedCaffeine

    CodedCaffeine Peon

    Messages:
    130
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    How and where is the data held that you're trying to put into that format? A SQL table, an array, or a string?
     
    CodedCaffeine, Jan 17, 2010 IP
  3. JAY6390

    JAY6390 Peon

    Messages:
    918
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #3
    before you loop through your data, put the variable
    $counter = 0;
    PHP:
    Then in the loop put
    if($counter++ % 3) echo '<br />';
    PHP:
    Be sure to change the <br /> to whatever code you want to break the content up
     
    JAY6390, Jan 17, 2010 IP