@douwe_yntema - Because there is always a maintitle and a subtitle, both links are displayed. That's why you have the maintitles twice.
You are not understanding me; I DO NOT want it that way. I want main title with sub-titles underneath each main title in the proper sequence. Main titles AND sub-titles can have their own distinct posts. If I forget all this and use the added 'topic_order' field that I manually added to the table I can make everything display properly with post counts AND the correct topic_id's but it's a cheat and I can't do it that way. Because the 'topic_order' will change everytime a sub-topic is added or deleted which would require manually changing that field every time.
Anyway I think your suggestion will work I just have to figure out the display part but I need a 'distinct topic_id'; so far everything I've tried won't work with your code.
I understand what you want, but the way it is displayed now is because there is always a maintitle and a subtitle. That fact is causing it is not displayed you want it.
Thanks for trying to help douwe. Your code actually works just not in the way I need. I guess I'll just stick with the added dbfield and will just have to modify it manually on sub-topic changes.
You can view all discussion threads in this forum. You cannot start a new discussion thread in this forum. You cannot reply in this discussion thread. You cannot start on a poll in this forum. You cannot upload attachments in this forum. You can download attachments in this forum. You cannot up or down-vote on the post in this discussion thread. You cannot set up a bounty in this discussion thread.