ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 15th, 2005, 02:17 PM
charmed0rz charmed0rz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 142 charmed0rz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 h 49 m 31 sec
Reputation Power: 5
Getting Forum Replies

I am needing the replies to each thread.. i know how to do the queries.. but since theres 1 not specific thread that i am getting replies from.. not sure how to do it... am sure its probably a loop but i never had much luck with loops? can anyone help


<cfquery name="get_main_topic" datasource="aeris7282">
Select * From Forum_Main_Thread
</cfquery>
<cfoutput query="get_main_topic">


now i have alot of threads here.. ie
thread 1 (ID: 1) Replies: ?
thread 2 (ID: 2) Reples: ?
thread 3 (ID: 3) Reples: ?



but since there is more then 1 main thread on that page, i cant figure out how to incorporate this code:

<cfquery name="get_main_topic" datasource="aeris7282">
select * from Forum_Threads
where ID = '#ID#'
</cfquery>
<cfoutput>#get_main_Topic.recordcount#</cfoutput>

Reply With Quote
  #2  
Old February 15th, 2005, 02:53 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,661 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 14 h 23 m 22 sec
Reputation Power: 53
Sorry but I don't understand what you are asking for.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old February 15th, 2005, 10:08 PM
Shane_Z Shane_Z is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Location: In denial
Posts: 22 Shane_Z User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 57 m 52 sec
Reputation Power: 0
Send a message via MSN to Shane_Z
sounds like you want to set the query for the main topics like you are doing, but loop it instead of output it.

Code:
 
<cfquery name="get_main_topic" datasource="aeris7282">
Select * From Forum_Main_Thread
</cfquery>

<cfloop query="get_main_topic">

<cfquery name="get_main_topic_replies" datasource="aeris7282">
select * from Forum_Threads
where ID = '#ID#'
</cfquery>

Thread #ID#: get_main_topic_replies.recordcount

</cfloop>


if that doesn't help, hopefully it will get you on the right track.

Reply With Quote
  #4  
Old February 16th, 2005, 09:30 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,661 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 14 h 23 m 22 sec
Reputation Power: 53
Actually if all you are trying to do is get the count of replies for each thread, you can do this in one query by using count() to count up the responses and then the GROUP BY clause to aggregate the results. You'd end up with a row for each thread that also has a field containing the count for the number of replies.

Reply With Quote
  #5  
Old February 17th, 2005, 08:52 PM
charmed0rz charmed0rz is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 142 charmed0rz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 h 49 m 31 sec
Reputation Power: 5
shane, when i do this it shows
thread 1 replies:0000 0000 0000 000
thread 2 replies:0000 0000 000
thread 3 replies:0000

not sure how to change it tho =/

Quote:
Originally Posted by Shane_Z
sounds like you want to set the query for the main topics like you are doing, but loop it instead of output it.

Code:
 
<cfquery name="get_main_topic" datasource="aeris7282">
Select * From Forum_Main_Thread
</cfquery>

<cfloop query="get_main_topic">

<cfquery name="get_main_topic_replies" datasource="aeris7282">
select * from Forum_Threads
where ID = '#ID#'
</cfquery>

Thread #ID#: get_main_topic_replies.recordcount

</cfloop>


if that doesn't help, hopefully it will get you on the right track.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Getting Forum Replies


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway