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

Displaying Cold Fusion Search Query Data in a table

Status
Not open for further replies.

tjg

Programmer
May 7, 2001
3
US
How can I display the data that is recalled from my cold fusion code below so that its is displayed in a table with two colums and twenty rows so that each row has two different results going across. I made a form to run a search of my database using the cold fusion code below. I have tried to put the results of the cold fusion query in a table but all I get is the same result repeated more than once across and the rest of query results going down the page with a copy of each next to eachother. I would like to have the results of the search to be displayed in a two column by twenty row table without having the results being displayed twice across. Really I want two differnt search results on the same row instead of having only one per row. I hear that I need to create a counter to assign numbers to each result so that they are not repeated if so how can i do this and set up this table. Thanks for your help.
Below is the code.

The code from my form.html:

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot;>
<form action=&quot;search9.cfm&quot; method=&quot;post&quot;>
<input type=&quot;text&quot; name=&quot;SearchFor&quot; value=&quot;&quot;>&nbsp;<input type=&quot;submit&quot; value=&quot;Search For Photos By Description&quot;>
</form>
</body>
</html>
------------------------------------------------------------
The code from my search.cfm file:

<CFQUERY DATASOURCE=&quot;tjg&quot; NAME=&quot;gwpr&quot;>
Select FileName,Description
From gwpr WHERE Description LIKE '%#form.SearchFor#%'
ORDER BY FileName
</CFQUERY>

<CFIF gwpr.Recordcount GTE &quot;1&quot;>


<table width=&quot;850&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>

<tr>
<td colspan=&quot;2&quot; align=&quot;center&quot;>
<p><font size=&quot;+3&quot; face=&quot;Arial&quot;><i><font color=&quot;navy&quot;>Search Results for
<cfoutput>#form.SearchFor#</cfoutput>...</font></i></font> </p>
<p>&nbsp; </p>
</td>
</tr>

<br>
<CFOUTPUT QUERY=&quot;gwpr&quot;>
<tr>
<td align=&quot;center&quot;>
<p><img src=&quot;photopages/photos/#FileName#&quot;> <br>
#Description#</p>
<p>&nbsp; </p>
</td>
</tr>
</CFOUTPUT>
</table>
<cfelse>

<BR><BR><BR>
<cfoutput>
<table width=&quot;800&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr>
<td align=&quot;center&quot;>
<font face=&quot;arial&quot; size=&quot;+2&quot; color=&quot;green&quot;>Sorry, your
search for #SearchFor# returned no results... Please Search for something
else!</font>
</td>
</tr>
</table>
</cfoutput>
<BR><BR><BR>
</cfif>

 
Try the MOD operator,
<TABLE>
<CFOUTPUT query=&quot;CategoryQuery&quot;>
<CFIF CurrentRow mod 2>
<TR>
</CFIF>
<CFSET CatID=CategoryID>
<TD width=&quot;50%&quot;>Hello world</TD>
</TABLE>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top