that's why i said you need a static variable to run it just once
PHP Code:
static $alreadychecked, $check;
if (!$alreadychecked)
{
$checkdata = $db->query_read("
SELECT dateline
FROM " . TABLE_PREFIX . "custom
WHERE userid = " . $vbulletin->userinfo['userid'] . "
AND threadid = " . intval($threadid)
);
if ($db->num_rows($checkdata))
{
$check = true;
}
else
{
$check = false;
}
$alreadychecked = true;
}