I have a page that gets article data from a database(I think that it is called 
a master/detail page). I can with help from this list display all the articles, 
but I would like to display the articles by year. That is, loop through the 
article_id for each year(such as 1 to 12 for the fist year. I was think that I 
could use this, but it still displays all the articles. Could somebody please 
help. When I take out the "SELECT * FROM articles" I get a "Can not issue empty 
query." error.
Thanks so much,
John:
<cfquery name="get_articles" datasource="articles">

        Select article_id, article_title, date_entered from articles
   </cfquery>
   
   <cfquery name = "get_articles" 
                                                          dataSource = 
"articles"> 
                                                          SELECT * FROM articles
                                                        </cfquery>
                                                        <cfloop query = 
"get_articles"> 
                                                        <cfset Start = 1> 
                                                        <cfset End = 12> 
                                                        
                                                        </cfloop>

Here is the original code:
<!--- main Page, to display links--->
<cfquery name="get_articles" datasource="articles">
    Select article_id, article_title, date_entered from articles
</cfquery>


<cfoutput query="get_articles">
  <a href="complete_article_page.cfm?article_id=#article_id#" 
target="_blank">#article_title#</a><br>
  #date_entered#<p>
</cfoutput>

<!--- output page, to display articles--->
 <cfquery name="get_articles" datasource="articles">
    Select article_id, article_title, date_entered from articles
   </cfquery>
   
<cfquery name="get_article" datasource="articles">
    select article_title, article_text, date_entered from articles where 
article_id = '#article_id#' 
 </cfquery>

<cfoutput>#get_article.article_title#</cfoutput></p>
<cfoutput>#get_article.article_text#</cfoutput></p>


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3186
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to