How does db for a forum look like?

Jangga

Junior Member
Joined
Aug 8, 2016
Messages
196
Reaction score
11
Pls, I'm about to create a php code which will accept message messages from users, store in db, then can be read by admin & admin can reply the message. I want the message from user & admin's reply to appear like it's a thread(just like this thread you are viewing) so we can chat more.
The problem is I don't know how the db will look like. Messages upon messages on a thread will enter a column in db? I'm so confused.

I need insights on the db structure & possible assistance in writing the php code. Pls guy help me here.. I haven't work on a forum code before

Plssssss
 
Assign unique thread number to first post, all additional posts on same thread should carry the same number and then you can display them according to time or additional column for number of post. This is pretty simple, are you sure you are capable making it if you cant figure this out
 
Assign unique thread number to first post, all additional posts on same thread should carry the same number and then you can display them according to time or additional column for number of post. This is pretty simple, are you sure you are capable making it if you cant figure this out
I understand you boss. But, I'm quite confused. The reply(s) to the thread should be on a new column or row?
 
Whats wrong with that? how exactly did you picture it? multiple columns in same row for reply1,reply2...?
Lol yea....

But, I'm wise now. Thanks to you. If I run into any probs when writing the code, I'll inbox u for some help. Pls can u pm me ur skype or u prefer I continue sending the question here if I run into probs
 
Hi Jangga,

You have to add one field to maintain main thread reference id for your messages table.
If user or admin replied to any thread/post, a new row will insert into your message table with the reference id of main thread id. It will help you to get all the posts (main thread and its all replies) based on a condition (WHERE id = 1 OR reference_id = 1).

Note:
Don't maintain all replies in the same row. It will reduce your query performance and raise some issues based on your future updates.
 
Lol yea....

But, I'm wise now. Thanks to you. If I run into any probs when writing the code, I'll inbox u for some help. Pls can u pm me ur skype or u prefer I continue sending the question here if I run into probs
I'd prefer if you post here, that way anyone facing similar problems in future can see answers here.
 
Back
Top