your best bet would be to scrap the way you done it in order of something alot simpler
PHP Code:
$field5stat = array();
$dbquery = $DB_site->query("SELECT field5 FROM " . TABLE_PREFIX . "userfield ASC");
while ($queryrow = $DB_site->fetch_array($dbquery))
{
if ($queryrow[field5] == "blue")
{
$field5stat['bue']++
}
else if ($queryrow[field5] == "red")
{
$field5stat['red']++
}
}
then echo template to echo values
theirs propably parse errors but you seem competant enough to sort that out.