I want to show in each forum top 5 most replied threads but I am terrible at PHP so could you please help me out with a query to fetch 5 threads with most replies in descending order from most to lest?
$query = $db->simple_select("threads", "*", "fid = '".intval($mybb->input['fid'])."'", array("order_by" => 'replies', "order_dir" => 'desc', "limit" => '5'));
Thanks very much. Will this query return thread:
Prefix
Title
Views
Replies
Lastpoter
Could you please teach me how to create those?
My English is not good and I think I'm not good teacher
If you have a problem PM to me with link to thread i try help you
You are awesome thanks very much I have just sent you PM.
How about this one! How to make it retrieve threads only from that for and not from the entire board?
$threadlimit = 5;
$query = $db->query("
SELECT t.*, t.subject AS threadsubject, u.username, u.displaygroup, p.displaystyle AS threadprefix,
t.dateline AS threaddate, t.lastpost AS threadlastpost
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."threadprefixes p ON (p.pid=t.prefix)
LEFT JOIN ".TABLE_PREFIX."users u ON (t.lastposter=u.username)
WHERE t.visible = '1' And t.uid = '{$memprofile['uid']}'
GROUP BY t.tid
ORDER BY threadlastpost DESC
LIMIT 0, {$threadlimit}
");
(2014-05-18, 02:48 PM)marcus123 Wrote: [ -> ]Thanks very much. Will this query return thread:
Prefix
Title
Views
Replies
Lastpoter
Could you please teach me how to create those?
You wont to show
Prefix ok
Title what do you mean ?
Views ok
Replies ok
Lastpoter only name ? or name(profile link)?
Thread subject
Last poster name linked to its profile!
Thanks very much.
Dude I love you, you just saved the day. OMG where were you man we need more users like you! Thanks very I mean VERY much.