Jump to content

Forums Question


Sacred

Recommended Posts

I hope this is the right place to post this. Anyway, I was wondering, I've seen all these amazing forums out there, but one thing has questioned me... how do you do it? I know there are online free places to do it, but I want to learn how to do it manually. I know where to download the phpbb3 or whatever, but after that.. well who knows. Can someone tell me how this works or at least direct me to a good tutorial? Thanks for reading. -Sacred

Link to comment
Share on other sites

The book I learned (what little I know of) PHP and MySQL from had a very basic forum as one of their test cases. The basic idea is to have a table for forum topics and a table for forum posts (this example doesn't do any sort of registration or login - you can identify yourself with any string you want, but it's a good start). The add topic page is just a form that asks for the identifier you want (email address or username), topic title, and the content of the post. This form sends the info to a script that adds the topic into the forum topics table (which holds details of the topic creation time, starter and title). The insert id of this query becomes the foreign key in the forum posts table, to which is added the post text, creation time and owner (poster). To display all the topics, you just fetch the topic titles from the forum topic table and loop through the result array, creating a neat display of links. The links contain a parameter that you can use to fetch the posts from the forum posts table (remember the key for this table is the topic insert id, so you will use it to get only posts for the right forum). Again, loop through the results from the forum posts table and create a display then echo it.To add a reply, you fill in a form and the query that was the second query in the new topic action does the work of adding a new record in the forum posts table. Every other bit of functionality is up to you, but it's that simple to make the basic forum.

Link to comment
Share on other sites

Oh, sorry, I was assuming a certain level of knowledge. MySQL is a free database system, which is easy to use and most hosting companies have it enabled because it's open source. You use it to store and cross reference data. You can do it in other ways, but it's the quickest and easiest to use and gives you faster responses than using plain text or XML files as a buffer/container for information. PHP makes access very easy, too.The book I have is called Sams Teach Yourself PHP, MySQL and Apache by Julie C. Meloni. It's very well written and clear to understand.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...