|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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> |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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. |
|
#4
|
|||
|
|||
|
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.
|
|
#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:
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Getting Forum Replies |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|