query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • monion
    New Member
    • Sep 2009
    • 18

    query

    What is the easiest way to format a 1 record query of select * from....
    When I have maybe 40 or 50 fields/columns in a row and I want the format to be
    col1
    col2
    col3 col4 col5 col6
    col7 col8 col9 col10
    col11 col12 col13 col14

    so basically col1 (id)
    col2 timestamp

    col3-col??? data, but I want the data to print 4 per line.

    Thanks,
    MO
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    one possibility (pseudo code):
    Code:
    // open table, open row
    
    // table cell display 1&2
    
    while ($result-set)
    {
      // table row after 4 cells
      if (0 == $i % 4)
      {
        echo "</tr><tr>";
      }
    
      // table cell display …
    
      // count table cells
      $i++;
    }
    
    // fill table cells until $i mod 4 = 0, close row, close table
    for the first two rows, apply the easiest thinkable code.

    Comment

    Working...