I have a problem. my designer is gone and left me with this project that I have to make some changes. I have a problem with this file. There is a list of games with assigned referees to a game. but this list shows only those games where are referees assigned before, but I want the the will show me all the games that need to be assigned.
<?php include("connect.php");
include("admin.session.php");
$LeftLinkSection = 1;
$pagetitle="Referees To Game";
if(isset($_GET['did']))
{
$sql="delete from assigned_games where id=".$_GET['did'];
$res=mysql_query($sql);
echo mysql_error();
header('location:message.php?mid=27');
}
if($_POST['sub11']==1)
{
//echo 'ts';
}
if($_GET['league_id']!='')
$league=$_GET['league_id'];
?>
<HTML>
<HEAD><title><?=Site_Title; ?></title>
<SCRIPT language="javascript" src="body.js"></SCRIPT>
<script>
function show_divisions(val)
{
window.location.href='manage_referees_to_game.php?league_id=' + val;
}
function show_getgames()
{
if(document.getElementById('txtfromdate').value!='' && document.getElementById('txttodate').value=='')
{
alert('Please Select To Date');
document.getElementById('txttodate').focus();
return false;
}
if(document.getElementById('txttodate').value!='' && document.getElementById('txtfromdate').value=='')
{
alert('Please Select From Date');
document.getElementById('txtfromdate').focus();
return false;
}
if(document.getElementById('txttodate').value < document.getElementById('txtfromdate').value)
{
alert('To Date can not be less then From Date');
document.getElementById('txttodate').focus();
return false;
}
document.getElementById('sub11').value=1;
document.frmgetgames.submit();
}
function clearall()
{
document.getElementById('txtfromdate').value='';
document.getElementById('txttodate').value='';
document.getElementById('refsel').value='';
document.getElementById('drpdivisions').value='';
}
function openWin(pageToLoad, winName, width, height, center,scrollbar){
if ((parseInt(navigator.appVersion) >= 4 ) && (center)){
xposition = (screen.width - width) / 2;
yposition = (screen.height - height - 100) / 2;
args = "width=" + width + "," + "height=" + height + "," + "location=0," + "menubar=0," + "resizable=no," + "scrollbars=" + scrollbar + "," + "status=0," + "titlebar=0," + "toolbar=0," + "hotkeys=0," + "screenx=" + xposition + "," + "screeny=" + yposition + "," + "left=" + xposition + "," + "top=" + yposition;
newWindow = window.open(pageToLoad,winName,args);
window.focus;
}
}
</script>
<script src="calendar.js"></script>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="MSHTML 6.00.2600.0" name=GENERATOR>
<link rel="stylesheet" href="main.css" type="text/css">
<style type="text/css">
<!--
.style3 {color: #FFFFFF}
-->
</style>
<style type="text/css">
/* media neutral styles go here */
@media print {
.noprint { display: none; }
}
</style>
</HEAD>
<BODY leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0 class="th-a">
<TR><TD height=60 valign="top" colspan="2" bgColor="#ffffff"><div class="noprint"><? include("top.php") ?></div></td></TR>
<tr>
<td width="20%" valign="top" bgcolor="#1c6995"><div class="noprint"><? include("left.php"); ?></div></td>
<td width="80%" valign="top" bgcolor="#FFFFFF" height="480">
<TABLE width="97%" border=0 cellPadding=0 cellSpacing=0 align="center">
<TR><TD width="100%" class="H1"><div class="noprint"> </div></TD></TR>
<TR><TD align="center" width="100%" class="a-l"><div class="noprint"><?php echo $Message2 ; ?></div></TD></TR>
<TR>
<div class="noprint"><? if($msg!="") { ?></div>
<TR><TD align="center" width="100%" class="a-l"><font color="red"><b><div class="noprint">User Deleted Successfully</div></b></font></TD></TR>
<TR>
<? } ?>
<TD width="100%" class="H1"><div class="noprint">Manage <?=$pagetitle?></div></TD>
</TR>
<TR><TD background="images/vdots.gif"><div class="noprint"><IMG height=1 src="images/spacer.gif" width=1 border=0></div></TD></TR>
<tr>
<TD>
<div class="noprint"><FORM name="order" action="#" method="post"></div>
<TABLE cellSpacing=0 cellPadding=1 border=0 >
<tr><td colspan="25" height="20"><div class="noprint"><b>View By Main Referee Name</b></div></td></tr>
<div class="noprint"><?=$prs_pageing->order();?></div>
</TABLE>
</form>
<br><div class="noprint"><form name="frmgetgames" id="frmgetgames" method="post"></div>
<div class="noprint"><table cellpadding="0" cellspacing="0" border="0">
<td width="100%" colspan="2" align="left"><select id="refsel" name="refsel">
<div class="noprint"><option value="" <? if($_POST['refsel']==' ') echo "selected='selected'"; ?>>--Select--</option></div>
<div class="noprint"><option value="0" <? if($_POST['refsel']!='') { if($_POST['refsel']==0) echo "selected='selected'"; } ?>>Games with NO REFEREE Assigned</option></div>
<div class="noprint"><option value="1" <? if($_POST['refsel']==1) echo "selected='selected'"; ?>>Games with NO Main Referee Assigned</option></div>
<div class="noprint"><option value="2" <? if($_POST['refsel']==2) echo "selected='selected'"; ?>>Games with NO Assistant Referee 1 Assigned</option></div>
<div class="noprint"><option value="3" <? if($_POST['refsel']==3) echo "selected='selected'"; ?>>Games with NO Assistant Referee 2 Assigned</option></div>
</select> <select name="drpleague" id="drpleague" style="width:150px" onChange="show_divisions(this.value)">
<div class="noprint"><option value="">--Select--</option></div>
<div class="noprint"><?
$sql_league="select * from league";
$res_league=mysql_query($sql_league);
while($row_league=mysql_fetch_object($res_league))
{
?></div>
<div class="noprint"><option value="<?=$row_league->id?>" <? if($row_league->id==$league) echo "selected='selected'"; ?>><?=stripslashes($row_league->league_name)?></option></div>
<? } ?>
</select> <? if($league!='') { ?><div class="noprint"><select id="drpdivisions" name="drpdivisions"></div>
<div class="noprint"><option value="">--Select Division--</option></div>
<?
$sql_division="select * from divisions where league_id=".$league." order by dname";
$res_division=mysql_query($sql_division);
while($row_division=mysql_fetch_object($res_division))
{
?>
<div class="noprint"><option value="<?=$row_division->id?>" <? if($_POST['drpdivisions']==$row_division->id) echo "selected='selected'"; ?>><?=stripslashes($row_division->dname);?></option></div>
<? } ?>
</select><? } ?>
</td></tr>
<tr>
<td width="100%" colspan="2" align="center"><div class="noprint">
From Date: </div><input type="text" name="txtfromdate" readonly="true" id="txtfromdate" size="15" value="<?=stripslashes($_REQUEST['txtfromdate']);?>"> <a href="#" onClick="getCalendar(document.getElementById('txtfromdate'));"> Select Date</a> To Date: <input type="text" name="txttodate" readonly="true" id="txttodate" size="15" value="<?=stripslashes($_REQUEST['txttodate']);?>"> <a href="#" onClick="getCalendar(document.getElementById('txttodate'));"> Select Date</a> <input type="button" value="Get Games" onClick="show_getgames();"><input type="hidden" id="sub11" name="sub11" value="0"> <input type="button" value="Clear" onClick="clearall();">
</td>
</tr>
<tr><td colspan="2"> </td></tr>
<tr>
</table></form><br>
<?
if($_GET["order"])
{
$order=$_GET["order"];
$strQueryPerPage="select lea.league_name,ht.tname as htname,at.tname as atname,d.dname,g.gdate,g.gtime,ag.id,ag.gid,ag.main_ref_id,ag.ast_ref_id1,ag.ast_ref_id2,ag.main_ref_accept,ag.ast_ref1_accept,ag.ast_ref2_accept,r1.fname as r1fname,r1.lname as r1lname,r2.fname as r2fname,r2.lname as r2lname,r3.fname as r3fname,r3.lname as r3lname from assigned_games ag left outer join referees r1 on ag.main_ref_id=r1.id left outer join referees r2 on ag.ast_ref_id1=r2.id left outer join referees r3 on ag.ast_ref_id2=r3.id left outer join games g on ag.gid=g.gid left outer join divisions d on g.div_id=d.id left outer join league lea on g.league_id=lea.id left outer join teams ht on g.home_team_id=ht.id left outer join teams at on g.away_team_id=at.id where r1.fname like '$order%'";
}
else
$strQueryPerPage="select lea.league_name,ht.tname as htname,at.tname as atname,d.dname,g.gdate,g.gtime,ag.main_ref_id,ag.ast_ref_id1,ag.ast_ref_id2,ag.id,ag.gid,ag.main_ref_accept,ag.ast_ref1_accept,ag.ast_ref2_accept,r1.fname as r1fname,r1.lname as r1lname,r2.fname as r2fname,r2.lname as r2lname,r3.fname as r3fname,r3.lname as r3lname from assigned_games ag left outer join referees r1 on ag.main_ref_id=r1.id left outer join referees r2 on ag.ast_ref_id1=r2.id left outer join referees r3 on ag.ast_ref_id2=r3.id left outer join games g on ag.gid=g.gid left outer join divisions d on g.div_id=d.id left outer join league lea on g.league_id=lea.id left outer join teams ht on g.home_team_id=ht.id left outer join teams at on g.away_team_id=at.id where 1=1";
//echo $strQueryPerPage;
if($_POST['sub11']==1)
{
if($_REQUEST['txtfromdate']!='')
{
$txtfromdate=$_REQUEST['txtfromdate'];
$txtfromdate_arr=explode("-",$txtfromdate);
$txtfromdate=$txtfromdate_arr[2].'-'.$txtfromdate_arr[0].'-'.$txtfromdate_arr[1];
$txttodate=$_REQUEST['txttodate'];
$txttodate_arr=explode("-",$txttodate);
$txttodate=$txttodate_arr[2].'-'.$txttodate_arr[0].'-'.$txttodate_arr[1];
$strQueryPerPage.=" and g.gdate >='".$txtfromdate."' and g.gdate<='".$txttodate."'";
}
if($_POST['refsel']!='')
{
if($_POST['refsel']==0)
{
$strQueryPerPage.=" and ag.main_ref_id=0 and ag.ast_ref_id1=0 and ag.ast_ref_id2=0";
}
if($_POST['refsel']==1)
{
$strQueryPerPage.=" and ag.main_ref_id=0";
}
if($_POST['refsel']==2)
{
$strQueryPerPage.=" and ag.ast_ref_id1=0";
}
if($_POST['refsel']==3)
{
$strQueryPerPage.=" and ag.ast_ref_id2=0";
}
}
if($_POST['drpdivisions']!='')
{
$strQueryPerPage.=" and d.id=".$_POST['drpdivisions'];
$drp_division=$_POST['drpdivisions'];
}
if($_POST['drpleague']!='')
{
$strQueryPerPage.=" and lea.id=".$_POST['drpleague'];
$league=$_POST['drpleague'];
}
}
if(isset($_GET['sort']))
$strQueryPerPage.=" order by ".$_GET['sort']." ".$_GET['ordby'];
else
$strQueryPerPage.=" order by ag.id desc";
//echo $strQueryPerPage;
$strResultPerPage=mysql_query($strQueryPerPage);
$strTotalPerPage=mysql_affected_rows();
?>
<FORM name="form2" action="#" method="post">
<td align="right"><a href="#" onClick="javascript:window.print();"><div class="noprint"><b>PRINT</b></div></a> </td>
<TABLE width="100%" height="89" border=1 cellSpacing=0 class=t-a>
<!--DWLayoutTable-->
<TBODY>
<TR class="th-a">
<TD colspan="10">
<div class="noprint"><?
$result=$prs_pageing->number_pageing($strQueryPerPage,15,7);
?>
</div>
</TD>
</TR>
<TR class=th-a>
<TD width="10%" align="left"><a href="manage_referees_to_game.php?sort=lea.league_name&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">League Name</a></TD>
<TD width="10%" align="left"><a href="manage_referees_to_game.php?sort=d.dname&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Division</a></TD>
<TD width="8%" align="left"><a href="manage_referees_to_game.php?sort=g.gdate&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Game Date</a></TD>
<TD width="8%" align="left"><a href="manage_referees_to_game.php?sort=g.gtime&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Game Time</a></TD>
<TD width="12%" align="left"><a href="manage_referees_to_game.php?sort=at.tname&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Home Team</a></TD>
<TD width="12%" align="left"><a href="manage_referees_to_game.php?sort=ht.tname&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Away Team</a></TD>
<TD width="10%" align="left"><a href="manage_referees_to_game.php?sort=r1.fname&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Referee</a></TD>
<TD width="10%" align="left"><a href="manage_referees_to_game.php?sort=r2.fname&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Assistant Referee 1</a></TD>
<TD width="10%" align="left"><a href="manage_referees_to_game.php?sort=r3.fname&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Assistant Referee 2</a></TD>
<TD width="10%" align="center"><span class="style3"><div class="noprint">Option</div></span></TD>
</TR>
<?php
$tr="#f4f4f4";
$clr=1;
while($row = mysql_fetch_object($result))
{
if($tr=="#FFFFFF")
{
$tr="#efefef";
$col="#000000";
}
else
{
$tr="#FFFFFF";
$col="#000000";
}
$tmpid = $row->id ;
$tmpid = "";
$agid=$row->id;
?>
<tr bgcolor="<? echo $tr; ?>">
<TD align="left"><font color="<?=$col?>"><? echo stripslashes($row->league_name); ?></font></TD>
<TD align="left"><font color="<?=$col?>"><? echo stripslashes($row->dname); ?></font></TD>
<TD align="left"><font color="<?=$col?>">
<?
$txtgdate=$row->gdate;
$txtgdate_arr=explode("-",$txtgdate);
$txtgdate=$txtgdate_arr[1].'-'.$txtgdate_arr[2].'-'.$txtgdate_arr[0];
?>
<? echo stripslashes($txtgdate); ?></font></TD>
<TD align="left"><font color="<?=$col?>">
<?
$txtgtime=$row->gtime;
$txtgtime_arr=explode("-",$txtgtime);
$txtgtime=$txtgtime_arr[1].'-'.$txtgtime_arr[2].'-'.$txtgtime_arr[0];
?>
<? echo stripslashes($txtgtime); ?></font></TD>
<TD align="left"><font color="<?=$col?>"><? echo stripslashes($row->htname); ?></font></TD>
<TD align="left"><font color="<?=$col?>"><? echo stripslashes($row->atname); ?></font></TD>
<TD align="left"><font color="<?=$col?>"> <? echo stripslashes($row->r1fname).' '.stripslashes($row->r1lname); ?><br><? if($row->main_ref_accept=='P' && $row->main_ref_id!=0) echo "<font color='#FF9900'><b>Pending</b></font>"; ?><? if($row->main_ref_accept=='A') echo "<font color='#006633'><b>Accepted</b></font>"; ?><? if($row->main_ref_accept=='R') echo "<font color='#FF0000'><b>Rejected</b></font><a href='#' onclick=\"openWin('view_reason.php?mainref_id=$agid','test','550','500','true','yes');\">(View Reason)</a>"; ?></font></TD>
<TD align="left"><font color="<?=$col?>"> <? echo stripslashes($row->r2fname).' '.stripslashes($row->r2lname); ?></font><br><? if($row->r2fname!='') { if($row->ast_ref1_accept=='P' && $row->ast_ref_id1!=0) echo "<font color='#FF9900'><b>Pending</b></font>"; ?><? if($row->ast_ref1_accept=='A') echo "<font color='#006633'><b>Accepted</b></font>"; ?><? if($row->ast_ref1_accept=='R') echo "<font color='#FF0000'><b>Rejected</b></font><a href='#' onclick=\"openWin('view_reason.php?astref_id1=$agid','test','550','500','true','yes');\">(View Reason)</a>"; } ?></TD>
<TD align="left"><font color="<?=$col?>"> <? echo stripslashes($row->r3fname).' '.stripslashes($row->r3lname); ?></font><br><? if($row->r3fname!='') { if($row->ast_ref2_accept=='P' && $row->ast_ref_id2!=0) echo "<font color='#FF9900'><b>Pending</b></font>"; ?><? if($row->ast_ref2_accept=='A') echo "<font color='#006633'><b>Accepted</b></font>"; ?><? if($row->ast_ref2_accept=='R') echo "<font color='#FF0000'><b>Rejected</b></font><a href='#' onclick=\"openWin('view_reason.php?astref_id2=$agid','test','550','500','true','yes');\">(View Reason)</a>"; } ?></TD>
<TD align="center"><div class="noprint"><input name="button" type="button" class="bttn-s" onClick="location.href='edit_referee_to_game.php?id=<?php echo $row->id; ?>'" value="Edit Assignment"></div>
<div class="noprint"><INPUT class="bttn-s" onClick="deleteconfirm('Are you sure you want to delete this Assigned Referee to Game? \n','manage_referees_to_game.php?did=<?php echo($row->id); ?>');" type="button" value="Delete Assignment"></div>
</TD>
</TR>
<?
$parentary = NULL ;
}
?>
<input type=hidden name="total" value="<? echo $strTotalNewRow; ?>">
<TR align=center>
<TD colSpan=10>
<?
if(!$strTotalPerPage)
{
?>
<strong>No Referees To Game Detail Display</strong>
<?
}
?> </TD>
</TR>
</TABLE>
</FORM>
</TD>
</TR>
</TABLE>
</td>
</tr>
</TABLE>
</BODY></HTML>