Batters

“);
echo(“

“);
while($row=mysql_fetch_array($get_details)){
$get_player_info=@mysql_query(“SELECT *, DATE_FORMAT(DATE_ADD(DataDate, INTERVAL -1 DAY),’%c/%e’) AS BenDate FROM fantasy_daily WHERE PlayerID=$row[PlayerID] AND BatterPitcher=’batter’ AND DataDate>’$time[CloseTime]’ AND DataDate < DATE_ADD('$time[CloseTime]', INTERVAL 180 HOUR)"); $get_name=@mysql_query("SELECT PlayerName FROM fantasy_players WHERE MLBID=$row[PlayerID]"); $name=mysql_fetch_array($get_name); echo("

“);
while($stat=mysql_fetch_array($get_player_info)){
$get_name=@mysql_query(“SELECT PlayerName FROM fantasy_players WHERE MLBID=$stat[PlayerID]”);
$name=mysql_fetch_array($get_name);
if($stat[BatterABs]!=0)$average=number_format($stat[BatterHits] / $stat[BatterABs], 3);
else $average=number_format(0,3);
$total_h=$total_h + $stat[BatterHits];
$total_ab=$total_ab + $stat[BatterABs];
$total_r=$total_r + $stat[BatterRuns];
$total_hr=$total_hr + $stat[BatterHomeRuns];
$total_rbi=$total_rbi + $stat[BatterRBIs];
$total_sb=$total_sb + $stat[BatterStolenBases];
if($total_ab>0)$total_average=number_format($total_h / $total_ab, 3);
else $total_average=number_format(0,3);
echo(“

“);
}
}
echo(“

Name Date H AB Avg R HR RBI SB
$name[PlayerName]
$name[PlayerName] $stat[BenDate] $stat[BatterHits] $stat[BatterABs] $average $stat[BatterRuns] $stat[BatterHomeRuns] $stat[BatterRBIs] $stat[BatterStolenBases]
Weekly Total $total_h $total_ab $total_average $total_r $total_hr $total_rbi $total_sb

“);

$total_w=0;
$total_s=0;
$total_k=0;
$total_outs=0;
$total_er=0;
$total_bb=0;
$total_h=0;

$get_details=@mysql_query(“SELECT * FROM fantasy_usage WHERE UserID=$user AND WeekID=$week AND SeasonID=$season AND PositionID=’pitcher'”);
echo(“

Pitchers

“);
while($row=mysql_fetch_array($get_details)){
$get_player_info=@mysql_query(“SELECT *, DATE_FORMAT(DATE_ADD(DataDate, INTERVAL -1 DAY),’%c/%e’) AS BenDate FROM fantasy_daily WHERE PlayerID=$row[PlayerID] AND BatterPitcher=’pitcher’ AND DataDate>’$time[CloseTime]’ AND DataDate < DATE_ADD('$time[CloseTime]', INTERVAL 180 HOUR)"); $get_name=@mysql_query("SELECT PlayerName FROM fantasy_players WHERE MLBID=$row[PlayerID]"); $name=mysql_fetch_array($get_name); echo("

“);

while($stat=mysql_fetch_array($get_player_info)){
$get_name=@mysql_query(“SELECT PlayerName FROM fantasy_players WHERE MLBID=$stat[PlayerID]”);
$name=mysql_fetch_array($get_name);

$total_w=$total_w + $stat[PitcherWins];
$total_s=$total_s + $stat[PitcherSaves];
$total_k=$total_k + $stat[PitcherKs];
$total_outs=$total_outs + $stat[PitcherOuts];
$total_er=$total_er + $stat[PitcherERs];
$total_bb=$total_bb + $stat[PitcherBBs];
$total_h=$total_h + $stat[PitcherHits];

$innings_pitched=intval($stat[PitcherOuts]/3);
$part_innings=$stat[PitcherOuts]%3;
$real_ip=$stat[PitcherOuts]/3;
if($real_ip>0)$whip=number_format(($stat[PitcherBBs]+$stat[PitcherHits])/$real_ip,2);
else $whip=number_format(0,2);
if($real_ip>0)$era=number_format($stat[PitcherERs]/$real_ip*9,2);
else $era=number_format(0,2);
echo(“

“);
}
}
$innings_pitched=intval($total_outs/3);
$part_innings=$total_outs%3;
$real_ip=$total_outs/3;
if($real_ip>0)$whip=number_format(($total_bb+$total_h)/$real_ip,2);
else $whip=number_format(0,2);
if($real_ip>0)$era=number_format($total_er/$real_ip*9,2);
else $era=number_format(0,2);
echo(“

Name Date W S IP ER ERA BB H WHIP K
$name[PlayerName]
$name[PlayerName] $stat[BenDate] $stat[PitcherWins] $stat[PitcherSaves] $innings_pitched.$part_innings $stat[PitcherERs] $era $stat[PitcherBBs] $stat[PitcherHits] $whip $stat[PitcherKs]
Weekly Total $total_w $total_s $innings_pitched.$part_innings $total_er $era $total_bb $total_h $whip $total_k

“);

}else{
echo(“You are not logged in, and you do not have access to this page.”);
}

?>