(2017-01-18, 08:13 AM)Dead-i Wrote: Forum bit stats I believe the variable can't be move able I have tried this before didn't work.
Where are you trying to move it to?
I have one forum section that is used for reviews that isn't visible on the index, and I'd like to put in my sidebar something like, "We currently have xx reviews." under the list of latest ones.
I did actually manage to figure out something that works;
// Gather Review forum stats
$where = 'fid=6';
$query = $db->simple_select('threads', 'COUNT(tid) as threads', $where);
$review_threads = (int)$db->fetch_field($query, 'threads');
I'm not sure how efficient it is though, as now I've got that I have plans to use it for a couple of other sections, but if it's doing a query for each one, I'd prefer to someshow make it so that it's just one for all, rather than something like this;
// Gather Review forum stats
$where = 'fid=6';
$query = $db->simple_select('threads', 'COUNT(tid) as threads', $where);
$review_threads = (int)$db->fetch_field($query, 'threads');
// Gather more forum stats
$where = 'fid=7';
$query = $db->simple_select('threads', 'COUNT(tid) as threads', $where);
$more_threads = (int)$db->fetch_field($query, 'threads');
// Gather even more forum stats
$where = 'fid=8';
$query = $db->simple_select('threads', 'COUNT(tid) as threads', $where);
$evenmore_threads = (int)$db->fetch_field($query, 'threads');
I'm not knowledgeable about this at all, but I imagine there's a way to do it all with just one query.