I'm creating an article system, with catergorys kind of like a forum. I've got sub forums so if you was to click a fourm, the subs will appear in there and it could go on for ever if I made enough sub forums But I want to count how many articles there is in the forum and in all the sub forums that belong to it.
Here's the link to take a look at what I mean, click the php section and you'll get what I mean:
http://www.comppchelp.com/articles.php
Articles system
Re: Articles system
if you can get a list of subforums you can use that in a query
What is your database structure like ?
SELECT COUNT(`id`) FROM `articles` WHERE `category` IN (1, 2, 3)which should get the number of articles in the categories with ids 1, 2 and 3.
What is your database structure like ?
Re: Articles system
Can't be too sure as it's on my laptop and my new PC doens't have the webhost details nor database.
But I think:
(Catergories)
ID
Type(Not actually need atm)
Parent
Name
Place
(Articles)
ID
Parent
Title
UID
Date
But I think:
(Catergories)
ID
Type(Not actually need atm)
Parent
Name
Place
(Articles)
ID
Parent
Title
UID
Date
Re: Articles system
You need a way to get all of the child sections. Hmm.
You may have to not count the posts in sub sections, I don't think most forums do that anyway.
The only way to do it that I can think of would involve a lot of queries.
You may have to not count the posts in sub sections, I don't think most forums do that anyway.
The only way to do it that I can think of would involve a lot of queries.
Re: Articles system
http://dev.mysql.com/tech-resources/art ... -data.html
This may be of some use... no way to make it dynamic though
This may be of some use... no way to make it dynamic though
Re: Articles system
I'll just count the first sub catergories then, any after that doesn't matter
Re: Articles system
okayCarbine wrote:I'll just count the first sub catergories then, any after that doesn't matter
I think you would be able to get the first X pretty easily hmm.