Organizing a forum board

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
arpowers
Forum Commoner
Posts: 76
Joined: Sun Oct 14, 2007 10:05 pm
Location: san diego, ca

Organizing a forum board

Post by arpowers »

Hey guys,

I'm creating a discussion board (forum) on my site...

what is the best way of querying and ordering the posts (to sort by order of with last post per thread)

since I'm using two tables, it seem a little counter-intuitive (or at least hard to do elegantly)

Andrew
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

Heh???

Threaded message boards are best...easiest to follow anyways...but they usually come with the price of recursion...although it's possible to implement using loops...

One table for the subjects, shown as threaded indented entries based on timestamp or PKID or something. Use AJAX to load the body or if not available refresh the screen and show only the selected topic. This will save tons of bandwidth.

So...

1 table to hold message subjects
1 table to hold the contents of each message

That is about the easiest implementation I can think of...for a very basic forum...

p.s-Why does everyone want to build forums??? There are so many options (open source) and essentially they all offer the same thing...not like CMS where the diversity is so great that it often makes sense to roll your own... :P

Giver!!!
phpBuddy
Forum Commoner
Posts: 37
Joined: Mon Nov 05, 2007 3:42 am

Post by phpBuddy »

Hockey wrote:That is about the easiest implementation I can think of...for a very basic forum...
p.s Why does everyone want to build forums???
There are so many options (open source) ......
I agree!
There are so many variations, from very basic to more feature rich free open source forum software.
There is no need to design your own code.
There are also sites with an overview, demos and great help when decide what forum suits you:

:!: http://www.opensourcecms.com/index.php ---- Forums DEMO in left menu
:!: http://www.forummatrix.org/ ---- Choice Wizard

This is a very popular and very lightweight basic forum:
http://www.forummatrix.org/show/Vanilla

( ... but, Vanilla only 2 databases supported: MySql and Postgres. Not for example Sqlite )

My main, most important criteria for selecting a Forum or CMS software
is the supported database option I will have at my hands.

=====================================================

By the way, phpBB 3 is very promising!
I have installed most Release Candidate versions, a few days ago came phpBB 3.0 RC8
I never really liked phpBB 2.
Among the new features of phpBB 3 is: Sqlite and other database support now
Download and Install phpBB 3.0 RC8:
http://www.phpbb.com/downloads/
:)
User avatar
arpowers
Forum Commoner
Posts: 76
Joined: Sun Oct 14, 2007 10:05 pm
Location: san diego, ca

Post by arpowers »

Thanks for the replies..

the reason I'm building my own forum is because
it is deeply integrated into my application...
and if I used someone else's i would end up spending just as much time
tweaking it...
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

You learn a freaking crapload (excuse my language) from building your own forums/message boards. I know I did. And the customization and integration into my existing applications was seemless (because I coded it all). I'm all for you building your own forums! It's one of the best things I've ever did.

Here's how you order topics by their last post (as if you were viewing forums.devnetwork.net/forums.php?f=6 (or something like that))

Code: Select all

SELECT `fields`, `you`, `need` FROM `forumthreads` ORDER BY `time_of_last_reply` DESC
`time_of_last_reply` should be a unix timestamp (or you can use mysql date conversions in your query)

Of course, this may not be suitable for your database structure. If you could post the structure of those two tables, it would help us answer you better.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Choose the Right Board

Post by s.dot »

Seems like I'm moving a lot of posts concerning queries only to the Databases forum. I think this is what I should do. If this post involves PHP Code, too (which at this point I don't think it does), please inform me and I'll move it back to the php code forum.

Moved to databases:
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:1. Select the correct board for your query. Take some time to read the guidelines in the sticky topic.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
phpBuddy
Forum Commoner
Posts: 37
Joined: Mon Nov 05, 2007 3:42 am

Post by phpBuddy »

scottayy wrote:You learn a freaking crapload (excuse my language) from building your own forums/message boards. I know I did. And the customization and integration into my existing applications was seemless (because I coded it all). I'm all for you building your own forums! It's one of the best things I've ever did.
A guestbook or a weblog
is in fact not much different script, than a Forum.
A guestbook/weblog has got most of all functions needed.
Post, edit, delete posts/articles and display them as a Thread, with pagination.

The difference is about the only that a forum uses several threads.
So we need to 'multiply' the guestbook/weblog script.
And add the possibility to access different threads/topics.
Post Reply