Qbasicnews.com

Full Version: MySQL forum
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I was thinking that I might try to build a very simple forum that uses a mySQL database.
But I have one problem: I can't grasp how I would handle replies, i.e., which posts to show indented into the parent post.
Any ideas?
Recursion is your friend.
That helps. :roll:
I never did such a thing, but I think that maybe it could be done adding a field with the list of children a post has, so every post is linked that way with its children, and every children can have children, and so forth. Some kind of N-Ary tree.
...And each post has an ID, right?
Well, are you looking to make a tree forum like qb45 for bullitin like here?

here, i'd imagine it's very simple to make a bullatin board. keep a table of topics and a table of posts, ordered chonologically from oldest to newest. Just insert a post with the topic id, a unique id and the date when you insert. I'm sure there's much more efficient methods of doing things, as that would create a very large query, but that's just an uneducated guess that will work.

as for trees, recursion is in fact *not* your friend. With SQL, you want to reduce the number of queries. If you're taking extra steps to just read the forum, that's a problem. Jason was kind enough to show me some very good articles on tree structures that while they take a little more time to insert or delete posts, make reading the table itself very easy, much like the way the robboard at qb45 works with flatfiles (though on a much, much grander and far more efficient scale). I'll dig them up if that's what you're interested in making.
I was looking to make a tree forum, but I'll settle with a BB. Thanks.
Well, okay, but if you wanted a tree forum, like those better and I could probably help you make one.
That would be cool. Big Grin
But it wouldn't be for a while, anyway - content first, then frills. :wink:
cool. hear dat.
Pages: 1 2