At 5:04 PM +0100 3/22/09, abdulazeez alugo wrote:
Hi guys,
I need help on something I'm working on and its really eating me up
so I'll appreciate any help I can get on it.
I'm writing code for a site that posts a topic for discussion and
accepts comments (Just like a parliament).
There are different discussions for every day and the comments
should be displayed along with the corresponding topics per day.
Hi Alugo:
I wrote a similar thing for my site, see here: http://sperling.com
As you can see, on most pages people can add comment.
Considering such, the most important part I found was designing the
tables for the database. I used two tables, which follow showing
fields:
COMMENTS table
Fields
id <-- auto-increment id for comments
post_time <-- time of this post
poster_id <-- the id from the POSTERS table
page <-- the page the poster commented on
comment <-- the actual comment made by the poster
notify_me <-- an option for the poster to select IF they want to be
notified of additional posts
approved <-- option for me to use if I want the post to be displayed
POSTERS table
Fields
id <-- auto-increment id for posters
time <-- time of first post (i.e., registration)
poster <-- name of poster
email <-- email of poster (after confirmation of email address)
ip <-- ip of poster (taken from post)
web_site <-- web site of poster (if given)
banned <-- option for me to use if I want to ban this poster
So as you can see, this is one table for posters and each poster can
post many comments (i.e., a "one to many" relationship).
Each time a post is made, the posting method checks the database for
poster approval. Either the poster is approved, banned, or yet to be
registered -- each path is followed accordingly.
Note as each page is loaded the comments are pulled from the database
and shown, or not, depending upon if the poster is approved OR if I
have overridden the post. This allows me to ban the post, but not the
poster. But in most cases, if the poster post something that I don't
like, then the poster is also banned.
HTH's
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php