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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Output Query into Table

Status
Not open for further replies.

megaladon

Programmer
Sep 27, 2002
14
CA
I am trying to display data retrieved from a query into a table, however, the data is not to be displayed all in one row. I need the data retrieved to be displayed in their own row.
Example:

Text: #textboook#
ISBN: #ISBN#
Publisher: #Publisher#

I know how to display data in row, but I am having trouble getting this other format to work.
Any help would be appreciated.
 
Also, if there are more than one record retrieved from the database I would like the second record to be displayed in its own table below the first table.

THX
 
Here is how to do it...

<cfoutput query =&quot;book_list&quot; group=&quot;ISBN&quot;>
Text: #textboook#<br>
ISBN: #ISBN#<br>
Publisher: #Publisher#<br>
</cfoutput>


Have used the ISBN field as the 'primary key' - you might have different field in your database set up...

HTH!
 
BTW..forgot to mention - using the group field will allow the records to bunch together -- using your mention of &quot;table&quot; here is the same code within the context of a table:

<cfoutput query =&quot;book_list&quot; group=&quot;ISBN&quot;>
<table>
<tr>
<td>
Text: #textboook#
</td>
</tr>
<tr>
<td>
ISBN: #ISBN#
</td>
</tr>
<tr>
<td>
Publisher: #Publisher#
</td>
</tr>
</table>
</cfoutput>
 
THX Extras,

I have it working, but when the second set of data is displayed under the first table the info is spread out. It is almost like there is an invisible column in my table. Any suggestions on how to display a second set of data beneath the first set in a table?
 
Do not know what exactly your predicament is.. but, rather tnan building separate tables for each record group, why not just use one table and separate rows. you could diffrentiate between the grouped outputs by entering a blank row just before the end of each record...for example;
<table>
<cfoutput query =&quot;book_list&quot; group=&quot;ISBN&quot;>
<tr>
<td>
Text: #textboook#
</td>
</tr>
<tr>
<td>
ISBN: #ISBN#
</td>
</tr>
<tr>
<td>
Publisher: #Publisher#
</td>
</tr>
<tr>
<td>
&nbsp;
</td>
</tr>
</cfoutput>
</table>
 
The blank row works great, but the second set of data is shifted right for some reason???? This is how it looks

Text: Experience Multimedia, with CD
ISBN: 0138591660
Author: Sprankle and Johnson
Edition: 1999
Publisher: Prentice Hall


Text: Learn More
ISBN: 456754323
Author: Company
Edition: 2nd
Publisher: Brock

The table only has two columns, any suggestions to what is happening.

 
It helps to compare the output-html (using &quot;view source&quot; in the browser if you are using Explorer) and your coldfusion code...to see why there might be a formatting problem. Sometimes I also add a border of &quot;1&quot; just to see how the tables/cells/rows are aligning themselves.

Post the code and we could have a look...
 
Hi Extras,

I have it working, thanks for all your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top