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!

Output displays more than once

Status
Not open for further replies.

ivalum21

MIS
Jul 14, 2004
63
US
The output I am getting is correct. But it displays it three times, instead of one. I am display a question, and the answer to that question. I want it to run through that and display each question and answer once, but it displays it three times. Any ideas??

Here is my code:

Code:
<cfquery name="GetQuestion" datasource="ComplianceFAQ">
	SELECT *
	FROM FAQQandA, FAQQandACategory, FAQCategory
	WHERE FAQQandA.FAQID = FAQQandACategory.FAQID
		AND FAQQandACategory.FAQCatID = #URL.CatID#
</cfquery>

<html>
<head>
	<title>Compliance FAQ</title>
</head>

<body>
<cfoutput query="GetQuestion">
	<td>
	<b>#FAQQuestion#</b><br>
	<i>#FAQAnswer#</i>
	</td>
</cfoutput>

</body>
</html>
 
Try using the distinct clause after select (e.g. Select Distinct ....). If that does not work then do not use the query attribute in the cfoutput tag and display like this:

<cfoutput>
<b>#GetQuestion.FAQQuestion#<b><br>
<i>#GetQuestion.FAQAnswer#</i><br>
</cfoutput>
 
The DISTINCT clause just ordered the repeated questions together. And when I changed it to just <cfoutput>, it only displayed the first question, and not the others.
 
The problem is that you don't relate the table FAQCategory at all in this:

Code:
    FROM FAQQandA, FAQQandACategory, FAQCategory
    WHERE FAQQandA.FAQID = FAQQandACategory.FAQID
      AND FAQQandACategory.FAQCatID = #URL.CatID#

I'm sure that a field in FAQCategory relates directly to probably FAQQandACategory..

something like...

Code:
    FROM FAQQandA, FAQQandACategory, FAQCategory
    WHERE FAQQandA.FAQID = FAQQandACategory.FAQID
      AND FAQQandACategory.FAQCatID = #URL.CatID#
      [b]AND FAQQandACategory.FAQCatID=FAQCategory.FAQCatID[/b]

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top