|We don't bite newbies here... much|
Trying to display subcategories and countsby Anonymous Monk
|on May 04, 2000 at 22:05 UTC||Need Help??|
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I am a total newbie to perl, teaching myself so please bear that in mind!
I have a database (pipe delimited flat file) that I am accessing through CGI using a query_string eg. getoffers.cgi?Category&subcategory (eg. getoffers.cgi?Household&Alarms - this will give a list of all the alarm companies within the Household category)
The fields are in this order:
I have this part working fine and displaying the offers from their respective category and sub-category within the database file.
The problem I have is that I want to be able to display the list of sub-categories and the number of offers within each in a given category by calling getoffers.cgi?Category (this would, in the case of Household list all the sub-categories like so: Alarms (3) Antiques (2) Sub-category and the number of entries with that sub-category in brackets)
I am really stuck on this, I guess I have to make an array of all the sub-categories and then count the amount of same named entries, then display only one of each.
I hope I explained this in a way that at least one of you can understand!
Thanks in advance for any help.