debug = TRUE; $db->setTable("selections"); $db->query("select selections.race, selection, name from selections, programs, contestants where selections.racedate = '$today' and selections.selection = programs.number and selections.racedate = programs.racedate and selections.race = programs.race and contestants.uid = selections.uid order by selections.race"); while ($r = $db->fetchRow()) { $rce[$r[2]] = $r[0]; $prog[$r[2]] = $r[1]; $selections[$r[2]]++; } $db->free(); ?>

Top Contest Favorites:

pullVal('count(*)','racedate',$today,'selections'); while (list($h, $c) = each($selections)) { if ($cnt > $top) { break; } //print "

".ceil(($c / $tot)*100)."% selected #$prog[$h] $h in race $rce[$h]

"; print "

".$c." ".($c > 1 ? 'people' : 'person')." selected #$prog[$h] $h in race $rce[$h]

"; $cnt++; } } else { print "No Selections Available"; } ?>