I'm using:
PHP Code:
$messagecounters = array();
$pmcounts = $db->query_read("
SELECT COUNT(*) AS total, folderid
FROM " . TABLE_PREFIX . "pm AS pm
LEFT JOIN " . TABLE_PREFIX . "pmtext AS pmtext USING(pmtextid)
WHERE userid = $userid
GROUP BY folderid
");
while ($pmcount = $db->fetch_array($pmcounts))
{
$messagecounters["$pmcount[folderid]"] = intval($pmcount['total']);
}
$links = array();
foreach ($folders AS $key => $value)
{
$links[] = '<a href="' . THIS_SCRIPT . "?userid=$userid&folderid=$key\">$value (" . intval($messagecounters["$key"]) . ")</a>";
}
What did I do wrong?