Hi Chris,
I will certainly try this when I go home from school.
Thanks so much for your help,
John

----- Original Message -----
From: Chris Griffin <[EMAIL PROTECTED]>
Date: Monday, December 17, 2007 3:22 am
Subject: Re: cfquery loop
To: CF-Newbie <[email protected]>

> Would grouping by year and sorted by date work for you?
> 
> <cfquery datasource="articles" name="get_articles">
>       select *,year(date_entered as yr from articles order by date_entered
> </cfquery>
> 
> <cfoutput query="get_articles" group="yr"">
>       Year: #yr#
>       <cfoutput>
>                 #article_title#<br>
>       </cfoutput>
> </cfoutput>
> 
> 
> On Dec 17, 2007, at 2:04 AM, John Barrett wrote:
> 
> > 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">
> >   > target="_blank">#article_title#<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:3196
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