Ciao,
In my forums where I list all the threads, I want also to show links to pages.
Like: http://www.phpbb.com/community/viewforum.php?f=6 (As you can see, it prints the number of pages for the threads that have more than 1 page.)
How should I do so it prints Page 2 if it has more than 10 posts?
I'm not taking about paging, I have that already. I need to print links for pages for all threads.
I store the number of replies a thread has in its table, so its easy to get that but how should I do this? I have paging for posts in the threads, I print 10 posts per page. I guess could make something like
If num_replies > 10 print <link to threads page 1>
If num_replies > 20 print <link to threads page 2>
If num_replies > 30 print <link to threads page 3>
If num_replies > 40 print <link to threads page 4>
But that's ridiculous there has to be a better way.
My SQL:
SELECT t.id,t.poster,t.soggetto, t.posted,t.recentissimo,t.ultimo_id,t.num_views, t.num_replies, t.closed,t.sticky,t.moved_to
FROM threads AS t
WHERE t.forum_id=$id
ORDER BY t.sticky DESC, t.last_post DESC
LIMIT $startIndex, $threadsPerPage
Thanks!