Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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.

In reply to Trying to display subcategories and counts by Anonymous Monk

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2022-08-17 12:49 GMT
Find Nodes?
    Voting Booth?

    No recent polls found