2014-09-18, 12:04 PM
I have this plugin that shows how many times the post was given reputation but it creates 10 additional queries! How can I reduce the amount of queries. Is there a way to use maybe cache?
Since I don't know much about cache could you help?
Since I don't know much about cache could you help?
$query = $db->query("
SELECT r.pid, r.uid, COUNT(r.pid) AS reputation
FROM ".TABLE_PREFIX."reputation r
LEFT JOIN ".TABLE_PREFIX."posts p ON (r.pid=p.pid)
LEFT JOIN ".TABLE_PREFIX."users u ON (p.uid=u.uid)
WHERE r.pid = ".intval($post['pid'])."
group by r.pid ORDER BY reputation DESC
");
while($row = $db->fetch_array($query))
{
eval("\$post['test'] = \"".$templates->get("postbit_test")."\";");
}
}