#--get the table name from leaguename
$lname1=strtolower($lname);
$table=$lname1.'_teams';
#--collect the schedule inforamtion (gamedate,gametime,team1,team2,cris openers,etc) from new_asp_schedule
if($lno!='5')
{
$roadqry=mysqli_query($link,"select * from new_asp_schedule where game_date between '$startdate' and '$enddate' and league_no=$lno and (team1 not like '%Teams%' and team2 not like '%Teams%') order by game_date,game_no1 limit 1");
}
else
{
$roadqry=mysqli_query($link,"select * from new_asp_schedule where game_date between '$startdate' and '$enddate' and league_no=$lno and (team1 not like '%Teams%' and team2 not like '%Teams%') and (pitcher1!='' and pitcher2!='') order by game_date,game_no1 limit 1");
}
$rnum=mysqli_num_rows($roadqry);
if($rnum)
{
while ($roadrow=mysqli_fetch_array($roadqry))
{
$home_cris="";
$road_cris="";
$schedule_id=$roadrow['schedule_id'];#--league no
$league=$roadrow['league_no'];#--league no
$date=$roadrow['game_date'];#--game date on which game is scheduled
$time=$roadrow['game_time']; # --time of game
$road_gameno=$roadrow['game_no1']; #--road team game number
$home_gameno=$roadrow['game_no2'];#--home team game number
$road_score=$roadrow['team1_score']; #--road team score
$home_score=$roadrow['team2_score'];#--home team score
$road_team=$roadrow['team1'];#--road team name
$home_team=$roadrow['team2'];#--home team name
$road_pitcher=$roadrow['pitcher1'];#--road team pitcher
$home_pitcher=$roadrow['pitcher2'];#--home team pitcher
$road_pithand=$roadrow['pitcher1_hand'];#--road team picther's hand
$home_pithand=$roadrow['pitcher2_hand'];#--home team picther's hand
$game_total=$roadrow['game_total']; #--game total
$road_spread=$roadrow['team1_spread']; #---road team spread
$home_spread=$roadrow['team2_spread'];#---home team spread
$road_ML=$roadrow['team1_ML'];#---road team moneyline
$home_ML=$roadrow['team2_ML'];#---home team moneyline
$tot_overmoney=$roadrow['tot_overmoney'];#---total point over money
$tot_undermoney=$roadrow['tot_undermoney'];#---total point under money
$lmsel1=mysqli_query($link,"SELECT count(*) as count FROM thegreek_schedule WHERE league_no = '$league' AND game_date BETWEEN '$startdate' AND '$enddate' and (game_status='0' or game_status='1') and game_no1='$road_gameno' and game_no2='$home_gameno' GROUP BY game_no1 ORDER BY game_date, game_no1 ");
list($count)=mysqli_fetch_array($lmsel1);
if($league=='1' || $league=='18' || $league=='3' || $league=='2')#--leagueno 1 for NFL,18 for CFL,3 for NBA
{
if($road_spread<0 && $home_spread>0)
{
$road_cris=$road_spread;
$home_cris=$game_total;
}
elseif($home_spread<0 && $road_spread>0)
{
$road_cris=$game_total;
$home_cris=$home_spread;
}
elseif($home_spread==0 && $road_spread==0)
{
$road_cris=$road_spread;
$home_cris=$game_total;
}
$home_cris=abs($home_cris);
$road_cris=abs($road_cris);
}
elseif($league=='5' || $league=='7') #--5 is league no for MLB & 7 is for NHL
{
if($home_ML<0 && $road_ML>0)
{
$home_cris=$home_ML;
$road_cris=$game_total;
}
elseif($home_ML>0 && $road_ML<0)
{
$home_cris=$game_total;
$road_cris=$road_ML;
}
elseif(($home_ML<0 && $road_ML<0) && ($home_ML!=$road_ML))
{
if($home_ML<$road_ML)
{
$home_cris=$home_ML;
$road_cris=$game_total;
}
elseif($home_ML>$road_ML)
{
$home_cris=$game_total;
$road_cris=$road_ML;
}
}
elseif(($home_ML<0 && $road_ML<0) && ($home_ML==$road_ML))
{
if($tot_undermoney<0 && $tot_overmoney>0)
{
$home_cris=$home_ML;
$road_cris=$game_total;
}
elseif($tot_undermoney>0 && $tot_overmoney<0)
{
$home_cris=$game_total;
$road_cris=$road_ML;
}
elseif(($tot_undermoney<0 && $tot_overmoney<0) && ($tot_undermoney!=$tot_overmoney))
{
if($tot_undermoney<$tot_overmoney)
{
$home_cris=$home_ML;
$road_cris=$game_total;
}
elseif($tot_undermoney>$tot_overmoney)
{
$home_cris=$game_total;
$road_cris=$road_ML;
}
}
elseif(($tot_undermoney<0 && $tot_overmoney<0) && ($tot_undermoney==$tot_overmoney))
{
if($home_spread<0 && $road_spread>0)
{
$home_cris=$home_ML;
$road_cris=$game_total;
}
elseif($home_spread>0 && $road_spread<0)
{
$home_cris=$game_total;
$road_cris=$road_ML;
}
elseif(($home_spread<0 && $road_spread<0) && ($home_spread!=$road_spread))
{
if($home_spread<$road_spread)
{
$home_cris=$home_ML;
$road_cris=$game_total;
}
elseif($home_spread>$road_spread)
{
$home_cris=$game_total;
$road_cris=$road_ML;
}
}
elseif(($home_spread<0 && $road_spread<0) && ($home_spread==$road_spread))
{
$home_cris='pk';
$road_cris='pk';
}
}#2nd main elseif
}#main elseif
}#end of elseif for league
if(preg_match("/'/",$road_team))
{
$road_team=addslashes($road_team);
}
#chk for mlb
if($table=='mlb_teams')
{
$rqry=mysqli_query($link,"select team_id,team_name,alias_teamname from $table where new_teamname='$road_team'");
list($road_teamid,$road_team,$rteam)=mysqli_fetch_array($rqry);
}
elseif($table=='ncaaf_teams')
{
$rteam=$road_team;
$rqry=mysqli_query($link,"select team_id,team_name from $table where team_name='$road_team' or score_teamname='$road_team'");
list($road_teamid,$road_team)=mysqli_fetch_array($rqry);
if($road_team=='Texas A&M')
{
$road_team11='Texas A^M';
}else
{
$road_team11=$road_team;
}
}
else
{
$rteam=$road_team;
if($select =='CFL' && $road_team=='B.C. LIONS')
{
$road_team='BRITISH COLUMBIA';
$rteam=$road_team;
}
if($select =='NHL' && $road_team=='ST. LOUIS')
{
$road_team='ST LOUIS';
$rteam=$road_team;
}
$rqry=mysqli_query($link,"select team_id,team_name from $table where new_teamname like '%$road_team%'");
list($road_teamid,$road_team)=mysqli_fetch_array($rqry);
}
if(preg_match("/'/",$home_team))
{
$home_team=addslashes($home_team);
}
if($league==5)
{
$hqry=mysqli_query($link,"select team_id,team_name,alias_teamname from mlb_teams where new_teamname='$home_team'");
list($home_teamid,$home_team,$hteam)=mysqli_fetch_array($hqry);
}
elseif($table=='ncaaf_teams')
{
$hteam=$home_team;
$hqry=mysqli_query($link,"select team_id,team_name from $table where team_name='$home_team' or score_teamname='$home_team'");
list($home_teamid,$home_team)=mysqli_fetch_array($hqry);
if($home_team=='Texas A&M')
{
$home_team11='Texas A^M';
}else
{
$home_team11=$home_team;
}
}
else
{
if($select =='CFL' && $home_team=='B.C. LIONS')
{
$home_team='BRITISH COLUMBIA';
$hteam=$home_team;
}
if($select =='NHL' && $home_team=='ST. LOUIS')
{
$home_team='ST LOUIS';
$hteam=$home_team;
}
$hqry=mysqli_query($link,"select team_id,team_name from $table where new_teamname like '%$home_team%'");
list($home_teamid,$home_team)=mysqli_fetch_array($hqry);
}
//echo "$road_team----$home_team ";
?>
DATE :
}else{?>
DATE :
}?>
Time
Teams
Team Pitchers
}?>
Current Line
ATS Matchups Report
Quick Stats
Smart Stats
#chk for blank data
if(trim($road_team)!="" && trim($home_team)!="")
{
?>
#########################Game No with Team name########################
if($select=='MLB')
{
$name2=$date.'~'.$time.'~'.$road_teamid.'~'.$road_team.'~'.$home_teamid.'~'.$home_team.'~'.$lname.'~'.$road_pitcher.'~'.$road_pithand.'~'.$home_pitcher.'~'.$home_pithand.'~'.$road_gameno.'~'.$home_gameno;
?>
}
#########################Game No with Team name########################
#########################Game Pitcher FOR MLB########################
if($select=='MLB')
{
?>
()
()
}
#########################Game Pitcher FOR MLB########################
#########################Game Line Total########################
?>
#########################Game Line Total########################
#########################ATS MATCHUPS LINK########################
?>