SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    May 2004
    Location
    uk
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Directory type site.

    Iím trying to create a directory site. I have a table of links and one of the fields is which category the link is in. I would like to have a list of the categories and how many links in that category e.g.

    Cat one (10)
    Cat two (34)
    Cat three (12)

    Do I have to query the database every time I want to count the amount of links in each category? There must be another way?

    Cheers.

  2. #2
    SitePoint Wizard Crowe's Avatar
    Join Date
    Nov 2001
    Location
    Huntsville
    Posts
    1,117
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You could always do that via a cron job and write that information to a static file. Or use a "build" button in your admin screen that builds that count into a static file for you to include. I do this on one of my sites that has over 30,000 entries. Counting the rows is live is just too slow. So when I validate new items I click on a "build pages" link that builds the files I include for certain parts of the site.
    Chrispian H. Burks
    Nothing To Say

  3. #3
    SitePoint Zealot
    Join Date
    May 2004
    Location
    uk
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Crowe, I've found I can do what I need by using count(*) and group by.

    Cheers


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •