Quote:
Originally Posted by MarkFL
Okay, this is what I had in mind:
PHP Code:
$pinfract_this_year = $vbulletin->db->query_read("
SELECT infraction.*
FROM " . TABLE_PREFIX . "infraction AS infraction
WHERE dateline >= " . (TIMENOW - 365*86400) . "
AND expires = 0
");
$user_list = '';
while ($infract = $vbulletin->db->fetch_array($pinfract_this_year))
{
$userlist .= ($infract['userid'] . ',');
}
$userlist = rtrim($userlist, ',');
$vbulletin->db->query_write("
UPDATE " . TABLE_PREFIX . "user
SET new_column = CASE
WHEN userid IN (" . $userlist . ") THEN 1
ELSE 0
END
");
|
Yours looks a lot simpler than mine, and it makes sense because I can follow it through haha.
Is it possible to write the count rather than the 1 and 0?