This user has been denied support.
(2012-09-23, 07:37 PM)Yaldaram Wrote: You may just use the pid of the post. No need to use uid either. With this, your query would look like this;
$pid = intval($post['pid']);
$query = $db->simple_select("warnings", "*", "pid='{$pid}' AND expired='0'");
$check = $db->fetch_array($query);
Now use $check['pid'] to check if its true then show the icon and if its false removes icon.
That's nice, but runs the same amount of queries. Yes, uid isn't needed, I shall remove it in update, thanks.
(2012-09-23, 07:38 PM)euantor Wrote: Hope it helps I haven't used the get_forum function before so i've never really looked into it. Thinking about it, forums are cached so it likely just reads the cache.
I tried, but failed somehow and was presented with MySQL error, though I tried other way and that worked.
I defined $pids as global function and this is my query:
$query = $db->query("
SELECT u.uid
FROM ".TABLE_PREFIX."users u
JOIN ".TABLE_PREFIX."posts p ON (u.uid=p.uid) WHERE p.{$pids}
JOIN ".TABLE_PREFIX."warnings uw ON (uw.pid=p.pid)
WHERE uw.expired='0'
");
which throws error, but if instead I add p.{$pids} in end, like:
$query = $db->query("
SELECT u.uid
FROM ".TABLE_PREFIX."users u
JOIN ".TABLE_PREFIX."posts p ON (u.uid=p.uid)
JOIN ".TABLE_PREFIX."warnings uw ON (uw.pid=p.pid)
WHERE uw.expired='0' AND p.{$pids}
");
it works, but runs the same amount of queries.
Not too experienced with $pids, so any help would be appreciated.
Yes, that get_thread function is cached I think so because I used it for another plugin I coded a while back.