NYCPHP Meetup

NYPHP.org

[nycphp-talk] Newbie question: extract categories and display once

Glasgow West End james.byrne2 at ntlworld.com
Thu Feb 13 09:53:47 EST 2003


Hmm, nice and simple.

Thanks Jim.

> 
> From: "Jim Hendricks" <jim at bizcomputinginc.com>
> Date: 2003/02/13 Thu PM 01:12:53 GMT
> To: NYPHP Talk <talk at nyphp.org>
> Subject: Re: [nycphp-talk] Newbie question: extract 
categories and display once
> 
> A down and dirty way would be to define a variable 
which is initially blank
> or null.
> 
> At the top of your loop which you use to iterate through 
the articles check
> to see if the category associated with the article is the 
same as that
> stored in the variable.  If it is different, pump out the 
category info and
> set the variable to the category you just output.  If it is 
the same, skip
> outputting the category info.
> 
> This assumes that your query which obtains the data 
brings it back in
> category order.
> 
> Jim
> 
> ----- Original Message -----
> From: "QuicknEasyImage" 
<jim at quickneasyimage.com>
> To: "NYPHP Talk" <talk at nyphp.org>
> Sent: Thursday, February 13, 2003 3:06 AM
> Subject: [nycphp-talk] Newbie question: extract 
categories and display once
> 
> 
> > Hi,
> >
> > I am creating a MSQL database of articles, all 
labeled by categories -
> i.e.
> > marketing, copywriting, ecommerce and so on. I 
want to display the links
> to
> > these articles  on a web page, sorted by category. I 
only want to display
> > the category name on the web page once - and 
underneath that, all the
> > articles that fall into that category, then the next 
category name and all
> > the articles under that that fall into that category, and 
so on.
> >
> > I can extract and display the links to the articles 
easy enough, but can't
> > think how to make sure that the category name 
prints only once - at the
> top
> > of category list. Any ideas would be appreciated.
> >
> > Thanks,
> > Jim
> >
> >
> >
> >
> >
> > 
> >
> >
> >
> >
> 
> 
> 
> --- Unsubscribe at http://nyphp.org/list/ ---
> 
> 
> 




More information about the talk mailing list