Connecting Tech Pros Worldwide Help | Site Map

query

Newbie
 
Join Date: Sep 2009
Posts: 18
#1: Sep 29 '09
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's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,642
#2: Sep 29 '09

re: query


one possibility (pseudo code):
Expand|Select|Wrap|Line Numbers
  1. // open table, open row
  2.  
  3. // table cell display 1&2
  4.  
  5. while ($result-set)
  6. {
  7.   // table row after 4 cells
  8.   if (0 == $i % 4)
  9.   {
  10.     echo "</tr><tr>";
  11.   }
  12.  
  13.   // table cell display …
  14.  
  15.   // count table cells
  16.   $i++;
  17. }
  18.  
  19. // fill table cells until $i mod 4 = 0, close row, close table
for the first two rows, apply the easiest thinkable code.
Reply