Beat the Streak
2015 Champion: Riney Outlaw Express
echo " Week $week Results in $weekrace" ; ?>
Pos |
Name |
Score |
Selection |
Pts |
Bonus |
include ("db.php");
$btsquery=mysql_query("SELECT *,score+bonus as total FROM 2016btsseasontotals WHERE wk=$week Order by total DESC ") ;
$position_current = 0;
$position_count = 0;
$points_current = 0;
while ($row=mysql_fetch_array($btsquery)) {
//Set position count
$position_count++;
if ($points_current !== $row['total']) {
//New position
$points_current = $row['total'];
$position_current = $position_count;
}
//Display the current position
echo "$position_current |
{$row['name']} |
{$row['total']} |
{$row['selection']} |
{$row['score']} |
{$row['bonus']} |
";
}
echo " " ;
?>
|
$week = 30 ;
?>
Season Standings
(After Week echo $week ; ?>)
Pos |
Name |
Points |
$query = mysql_query("SELECT * , sum(score)+sum(bonus) as total FROM `seasonstandings` WHERE wk=1 or wk=2
or wk=3 or wk=4 or wk=5 OR wk=6 OR wk=7 OR wk=8 OR wk=9 OR wk=10 OR wk=11 OR wk=12
OR wk=13 OR wk=14 OR wk=15 OR wk=16 OR wk=17 OR wk=18 OR wk=19 OR wk=20 OR wk=21 OR wk=22
OR wk=23 OR wk=24 OR wk=25 OR wk=26 OR wk=27 OR wk=28 OR wk=29 OR wk=30
GROUP BY name ORDER BY total DESC ");
$position_current = 0;
$position_count = 0;
$points_current = 0;
while ($row=mysql_fetch_array($query)) {
//Set position count
$position_count++;
if ($points_current !== $row['total']) {
//New position
$points_current = $row['total'];
$position_current = $position_count;
}
//Display the current position
echo "$position_current | {$row['name']} | {$row['total']} | ";
}
echo " " ;
?>
|