Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Output data in table format

Status
Not open for further replies.

rmz8

Programmer
Aug 24, 2000
210
0
0
US
I have a list of 7 blocks of text, with elements that are outputted from a query. When I run the template, it lists them vertically. I want to be able to output them in a table, with three in each row, and one below. Here is the page:


Ryan ;-]
 
Try this:

<cfset num = 1>
<table>
<tr>
<cfoutput query=&quot;GetBrand&quot; startrow=#num# maxrows=3> <td valign=&quot;top&quot;>

....Codes for output....

<cfset #num# = #num# + 1>
</td></cfoutput>
<tr>
<table>
<tr>
<cfoutput query=&quot;GetBrand&quot; startrow=#num# maxrows=3> <td valign=&quot;top&quot;>

....Codes for output....

<cfset #num# = #num# + 1>
</td></cfoutput>
<tr>
<table>
<tr>
<cfoutput query=&quot;GetBrand&quot; startrow=#num# maxrows=3> <td valign=&quot;top&quot;>

....Codes for output....

<cfset #num# = #num# + 1>
</td></cfoutput>
<tr>

This is a longer methods, if you need it urgently u can use this. I'll be thinking of one. :)
 
Ryan, try this, I think it's what you want:

<table>
<tr>
<cfoutput query=&quot;MyQuery&quot;>
<td>#Column1#</td>
<td>#Column2#</td>
<td>#Column3#</td>
<cfif MyQuery.CurrentRow MOD 3 IS 0>
</tr>
<tr>
</cfif>
</cfoutput>
</tr>
</table>

If you want more records to be shown on one table-row, change the 3 in the CFIF statement.
Hope this helps...


<webguru>iqof188</webguru>
 
iq,

All of the data that I want to output in each cell is not contained within one row. So this will not work, correct?

Ryan ;-]
 
Please be more specific, I don't understand what you are trying to say :). I am sure we can find a solution to this problem, I love working with tables ;-).


<webguru>iqof188</webguru>
 
:)

What you have in the previous post is something that outputs different RECORDS within each cell (with three columns). However, I'm putting seven blocks of text (that contain HTML as well as data called from a query) within each cell.

Ryan ;-]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top