Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Database advise
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Database advise

 Post Reply Post Reply
Author
urko View Drop Down
Groupie
Groupie
Avatar

Joined: 23 September 2004
Location: Slovenia
Status: Offline
Points: 160
Post Options Post Options   Thanks (0) Thanks(0)   Quote urko Quote  Post ReplyReply Direct Link To This Post Topic: Database advise
    Posted: 22 February 2006 at 9:25am
Hi

Im making sort of a directory on my site.

Now I would need some advise how to build my DB ( access + asp ) for  categories / subcategories.

Momentarily I have 2 tables.
First one
TBLPRODUCTS is for products
second
TBLCATS include Categories + Sub Cateogries.

On my page everything works well, expect when I want to count records
(#) next to cateogries I always get 0 or it shows all:
expample:
Category1 (4)
.....Subcateogry (4)
Category2 (4)
.....Subcateogry (4)

...and I only have 4 products in my product table.

Can any1 give me some advise on how to make my DB (categories / subcategories)  so that users will be to see next to categories ( #) and when they click on certian cateogry it will show
Subcategories with correct (#).

I hope u know what I mean....sorry for my poor english

Thanks,Wink

 
Urko
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 22 February 2006 at 3:29pm
You need to do a recursive query counting subcategories, adding those up to the parent cateogory. If you do that on the fly for every display of that page, performance will be a drag. I would when adding a directory entry, put a counter on the category itself. Then you just need to add up the subcategories to the parents.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.