Forum Script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello friends.

I am currently trying to develop a forum system. All is going well, but I
was wondering if there woud be a way to do something that I'm already
doing that might be more efficient. First I'll give you some
background...
I am using php 4 and mysql 4.
I have a database setup, and I have a table set up for forum posts. I
have fields for which board it was posted on and which (if any) post it
was a reply to. If it wasn't a reply, that field will be left blank. For
these fields, I use a unique ID system, which makes an ID based on the
poster and when it was posted.
Now when I display them, I make a table for the subject (head), author,
last post, number of replies etc. I make it do a SELECT query and it gets
the results and displays them. Now the problem I come into is with the
number of replies.
Currently while it's doing the WHILE loop, it performs another query for
each post, checking how many posts have there reply field set to the
post's current ID. That works fine, but it means I'm doing (up to) 21
queries per page, which I would guess is alot. I was wondering if there
would be a way I could get the number of replies as a column in my first
query (where I get the forum posts). Or maybe there's a more effective
way by getting the number of replies first. I don't really want to store
the number of replies in the database, if I can.
If I'm not being clear or I'm not using proper netiquette, I appologize,
I'm new to this (mailing lists). Any help would be appreciated!
-- 
  Marcjon

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux