$newteam1_id=$roadteamid;$newteam1_gameno=$roadgameno;
#-----query to check ROAD TEAM TRENDS
//echo "select * from ats_smartstats where league_no='$lno' and game_date between '$startdate' and '$enddate' and (team_a='$newteam1_id' and game_number='$newteam1_gameno') order by random_id desc limit 10 ";
$stats_qry1=mysql_query("select * from ats_smartstats where league_no='$lno' and game_date between '$startdate' and '$enddate' and (team_a='$newteam1_id' and game_number='$newteam1_gameno') order by random_id desc limit 10 ");
$snum1=mysql_num_rows($stats_qry1);
if(!$snum1)
{
?>
Trends System
Trends Not Found
}
else
{
//echo "select * from ats_smartstats where league_no='$lno' and game_date between '$startdate' and '$enddate' and (team_a='$newteam1_id' and game_number='$newteam1_gameno') order by random_id desc limit 10 ";
#-------query to retrieve only team trends as road
$stats_roadqry=mysql_query("select * from ats_smartstats where league_no='$lno' and game_date between '$startdate' and '$enddate' and (team_a='$newteam1_id' and game_number='$newteam1_gameno') order by random_id desc limit 10 ");
$s_roadnum=mysql_num_rows($stats_roadqry);
if(!$s_roadnum)
{
?>
Team Trends
Team Trends Not Found
}
else
{
?>
Team System Trends
if($league!='MLB'){
?>
Team Trends
}else{?>
Team Trends
}?>
ATS
}?>
SU
O/U
Description
Win-Loss-Push
}?>
Win-Loss-Push
Over-Under-Push
while($stats_row1=mysql_fetch_array($stats_roadqry))
{
$stats_id1=$stats_row1['random_id'];
$message1=$stats_row1['message'];
if(preg_match('/~/',$message1))
{
$message1=preg_replace('/~/','-',$message1);
}
if(preg_match('/With no Situation/',$message1))
{
$message1=preg_replace('/With no Situation/','',$message1);
}
$ats_count1=$stats_row1['ats_count'];
$su_count1=$stats_row1['su_count'];
$over_under1=$stats_row1['over_under'];
$su_per1=$stats_row1['su_percentage'];
$su_per1=trim($su_per1);
$ats_per1=$stats_row1['ats_percentage'];
$ats_per1=trim($ats_per1);
$ou_per1=$stats_row1['ou_percentage'];
$ou_per1=trim($ou_per1);
/*------This is new code to chk star----------*/
$star_system1=$stats_row1['star_system'];
$star_system1=trim($star_system1);
$stars=explode("~",$star_system1);
$ats_stars=$stars[0];
$su_stars=$stars[1];
$ou_stars=$stars[2];
#----for any
#--for no star=>0
#--for red star=> 1
#--for green star=> 2
#--for blue star=> 3
switch($ats_stars)
{
case '0': $ats_star=""; break;
case '1': $ats_star=$star3; break;
case '2': $ats_star=$star1; break;
case '3': $ats_star=$star2; break;
}
switch($su_stars)
{
case '0': $su_star=""; break;
case '1': $su_star=$star3; break;
case '2': $su_star=$star1; break;
case '3': $su_star=$star2; break;
}
switch($ou_stars)
{
case '0': $ou_star=""; break;
case '1': $ou_star=$star3; break;
case '2': $ou_star=$star1; break;
case '3': $ou_star=$star2; break;
}
/*------End of new code to chk star----------*/
$count_sum1=$stats_row1['count_sum'];
$count_sum1=trim($count_sum1);
$csum1=explode("~",$count_sum1);
$ats_csum1=$csum1[0];
$su_csum1=$csum1[1];
$ou_csum1=$csum1[2];
#-----Check if the sum of w-l-t records is less than 3 then dont show it on userside
if($su_csum1 >=3)
{
?>
#-----Check if the sum of w-l-t records is less than 10 then dont show stars on userside
if($league!='MLB')
{
#---ATSwinner
if($ats_csum1 >=10)
{?>
}#end else of if($su_csum1 >=10)
#-----Over/Under
if($over_under1=='0-0-0')
{
?>
}
else
{
if($ou_csum1 >=10)
{
?>
}#end if($ou_csum1 >=10)
else
{
?>
}#end else of if($ou_csum1 >=10)
}
?>
}#end if($su_csum1 >=3)
}#end while
?>
}#end else
}
?>
$newteam2_id=$hometeamid;$newteam2_gameno=$homegameno;
#---chk for home team trends
$stats_qry2=mysql_query("select * from ats_smartstats where league_no='$lno' and game_date between '$startdate' and '$enddate' and (team_a='$newteam2_id' and game_number='$newteam2_gameno') order by random_id desc limit 10 ");
$snum2=mysql_num_rows($stats_qry2);
if(!$snum2)
{
?>
Trends System
Trends Not Found
}
else
{
#----query to retrieve team trends as home
$stats_homeqry=mysql_query("select * from ats_smartstats where league_no='$lno' and game_date between '$startdate' and '$enddate' and (team_a='$newteam2_id' and game_number='$newteam2_gameno') order by random_id desc limit 10 ");
$s_homenum=mysql_num_rows($stats_homeqry);
if(!$s_homenum)
{
?>
Team Trends
Team Trends Not Found
}
else
{
?>
Team System Trends
Team Trends
}else{?>
Team Trends
}?>
ATS
}?>
SU
O/U
Description
Win-Loss-Push
}?>
Win-Loss-Push
Over-Under-Push
while($stats_row2=mysql_fetch_array($stats_homeqry))
{
$stats_id2=$stats_row2['random_id'];
$message2=$stats_row2['message'];
if(preg_match('/~/',$message2))
{
$message2=preg_replace('/~/','-',$message2);
}
if(preg_match('/With no Situation/',$message2))
{
$message2=preg_replace('/With no Situation/','',$message2);
}
$ats_count2=$stats_row2['ats_count'];
$su_count2=$stats_row2['su_count'];
$over_under2=$stats_row2['over_under'];
$su_per2=$stats_row2['su_percentage'];
$su_per2=trim($su_per2);
$ats_per2=$stats_row2['ats_percentage'];
$ats_per2=trim($ats_per2);
$ou_per2=$stats_row2['ou_percentage'];
$ou_per2=trim($ou_per2);
/*------This is new code to chk star----------*/
$star_system2=$stats_row2['star_system'];
$star_system2=trim($star_system2);
$stars2=explode("~",$star_system2);
$ats_stars2=$stars2[0];
$su_stars2=$stars2[1];
$ou_stars2=$stars2[2];
#----for any
#--for no star=>0
#--for red star=> 1
#--for green star=> 2
#--for blue star=> 3
switch($ats_stars2)
{
case '0': $ats_star2=""; break;
case '1': $ats_star2=$star3; break;
case '2': $ats_star2=$star1; break;
case '3': $ats_star2=$star2; break;
}
switch($su_stars2)
{
case '0': $su_star2=""; break;
case '1': $su_star2=$star3; break;
case '2': $su_star2=$star1; break;
case '3': $su_star2=$star2; break;
}
switch($ou_stars2)
{
case '0': $ou_star2=""; break;
case '1': $ou_star2=$star3; break;
case '2': $ou_star2=$star1; break;
case '3': $ou_star2=$star2; break;
}
/*------End of new code to chk star----------*/
$count_sum2=$stats_row2['count_sum'];
$count_sum2=trim($count_sum2);
$csum2=explode("~",$count_sum2);
$ats_csum2=$csum2[0];
$su_csum2=$csum2[1];
$ou_csum2=$csum2[2];
#-----Check if the sum of w-l-t records is less than 3 then dont show it on userside
if($su_csum2 >=3)
{
?>
#-----Check if the sum of w-l-t records is less than 10 then dont show stars on userside
if($league!='MLB')
{
#---ATSwinner
if($ats_csum2 >=10)
{
?>