2015-03-07, 08:37 PM
I have a table that stores each thread tags not I wanna in the forums display threads list I am fetching each thread tags and show them there but it my code generates 1 query for each thread please help me to reduce it!
$plugins->add_hook("forumdisplay_thread","test");
$plugins->add_hook("forumdisplay_thread","test");
function test()
{
global $db, $forumtest, $thread;
$query = $db->simple_select("tags", "tags", "tid=".$thread['tid']);
$forumtest = $db->fetch_array($query);
if (!empty($forumtest['tags']))
{
$x = preg_replace('/\s*,\s*/', ', ', $forumtest['tags']);
$forumtest = $x;
}
else
{
$forumtest = "";
}
}