I just started coding a simple forum, kind of like this one for fun.
The problem I'm running into is when trying to order the threads by time desc within a specific forum because they need to be ordered by both threads and replies, but only display the thread name back:
First, I started with a table for threads and a table for replies.
Now, I've combined them into one, hoping it would make this task easier but I find, from my knowledge, I don't know how to run a query where the threads have different id values than those for the replies.
Example of thread:
id = 1
fid = 1 (forum id)
tid = null (since it's for the replies)
date = sooner
Example of reply for the above thread:
id = 2
fid = 1
tid= 1 (matches to id above)
date = later
Is there a way to do this the way I'm heading here... or would it be better to code the entire thing differently?
I suppose I could make tid match id for the threads, but how would I display back only the threads and not the replies, if the replied are newer than the threads?
I'm confusing myself trying to explain this, so I hope it makes little sense. 🙂