Jump to content

supplied argument is not a valid MySQL result resource in


miniu

Recommended Posts

Hello I have a file where I can see in a table the referee names below the status. I want to change it in an other file, but when I am doing this I receive this message:

 

mysql_fetch_object(): supplied argument is not a valid MySQL result resource in

 

I know that there is something wrong when I want to take the data from the database. Below is the file where the names are normally on the list.

 

<?	
  	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%'";
	$lname = stripslashes($selobj->lname);
}
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;

 

THIS IS THE RESULT FOR THIS:

<?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); ?><? if($row->main_ref_accept=='P' && $row->main_ref_id!=0) echo " (R) - <font color='#FF9900'><b> [PENDING]</b></font>"; ?><? if($row->main_ref_accept=='A') echo " (R) - <font color='#006633'><b> [Accepted]</b></font>"; ?><? if($row->main_ref_accept=='R') echo " (R) - <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>"; ?><br><? echo stripslashes($row->r2fname).' '.stripslashes($row->r2lname); ?><? if($row->r2fname!='') { if($row->ast_ref1_accept=='P' && $row->ast_ref_id1!=0) echo " (AR1) - <font color='#FF9900'><b> [PENDING]</b></font>"; ?><? if($row->ast_ref1_accept=='A') echo " (AR1) - <font color='#006633'><b> [Accepted]</b></font>"; ?><? if($row->ast_ref1_accept=='R') echo " (AR1) - <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>"; } ?><br><? echo stripslashes($row->r3fname).' '.stripslashes($row->r3lname); ?><? if($row->r3fname!='') { if($row->ast_ref2_accept=='P' && $row->ast_ref_id2!=0) echo " (AR2) - <font color='#FF9900'><b> [PENDING]</b></font>"; ?><? if($row->ast_ref2_accept=='A') echo " (AR2) - <font color='#006633'><b> [Accepted]</b></font>"; ?><? if($row->ast_ref2_accept=='R') echo " (AR2) - <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 ;
		  	}	  ?>

 

 

 

And this is that file that I want to change.

 

<?	
  	if($_GET["order"])
{
	$order=$_GET["order"];
    $strQueryPerPage="select ag.main_ref_accept,ag.ast_ref1_accept,ag.ast_ref2_accept,ag.id as agid,g.id,g.gid,d.dname,ht.tname as htname,at.tname as atname from games g inner join divisions d on g.div_id=d.id inner join teams ht on g.home_team_id=ht.id inner join teams at on g.away_team_id=at.id inner join assigned_games ag on g.gid=ag.gid where (main_ref_id=".$_SESSION["UsErId"]." or ast_ref_id1=".$_SESSION["UsErId"]." or ast_ref_id2=".$_SESSION["UsErId"].") and d.dname like '$order%'";
}
else
  	$strQueryPerPage="select ag.main_ref_accept,ag.ast_ref1_accept,ag.ast_ref2_accept,ag.id as agid,g.id,g.gid,d.dname,ht.tname as htname,at.tname as atname from games g inner join divisions d on g.div_id=d.id inner join teams ht on g.home_team_id=ht.id inner join teams at on g.away_team_id=at.id inner join assigned_games ag on g.gid=ag.gid where main_ref_id=".$_SESSION["UsErId"]." or ast_ref_id1=".$_SESSION["UsErId"]." or ast_ref_id2=".$_SESSION["UsErId"];

if(isset($_GET['sort']))
	$strQueryPerPage.=" order by ".$_GET['sort']." ".$_GET['ordby'];
else
	$strQueryPerPage.=" order by g.id desc";

//echo $strQueryPerPage;

 

THIS IS THE RESULT FOR THIS

<?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 = "";

        ?>
              <tr bgcolor="<? echo $tr; ?>">
      	    <TD  align="left"><font color="<?=$col?>"><? echo stripslashes($row->gid); ?></font></TD>
		<TD  align="left"><font color="<?=$col?>"><? echo stripslashes($row->dname); ?></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') echo "<font color='#FF9900'><strong>Pending</strong></font>"; if($row->main_ref_accept=='A') echo "<font color='#006633'><strong>Accepted</strong></font>"; if($row->main_ref_accept=='R') echo "<font color='#FF0000'><strong>Rejected</strong></font>"; ?></font></TD>
		<TD  align="left"><font color="<?=$col?>"> <? echo stripslashes($row->r2fname).' '.stripslashes($row->r2lname); ?></font><br><? if($row->ast_ref1_accept=='P') echo "<font color='#FF9900'><strong>Pending</strong></font>"; if($row->ast_ref1_accept=='A') echo "<font color='#006633'><strong>Accepted</strong></font>"; if($row->ast_ref1_accept=='R') echo "<font color='#FF0000'><strong>Rejected</strong></font>"; ?></font></TD>
		<TD  align="left"><font color="<?=$col?>"> <? echo stripslashes($row->r3fname).' '.stripslashes($row->r3lname); ?></font><br><? if($row->ast_ref2_accept=='P') echo "<font color='#FF9900'><strong>Pending</strong></font>"; if($row->ast_ref2_accept=='A') echo "<font color='#006633'><strong>Accepted</strong></font>"; if($row->ast_ref2_accept=='R') echo "<font color='#FF0000'><strong>Rejected</strong></font>"; ?></font></TD>
			<TD align="center"><input name="button" type="button" class="bttn-s" onClick="location.href='view_assigned_game.php?id=<?php echo $row->agid; ?>'" value="View">
		      </TD>
              </TR>
              <?  
		  		$parentary = NULL ;
		  	}	  ?>
          

 

Link to comment
Share on other sites

Right now the file that I want to change is showing ok, but without the referee names. I add the names here:

 

<TD  align="left"><font color="<?=$col?>"> <? echo stripslashes($row->r1fname).' '.stripslashes($row->r1lname); ?><br><? if($row->main_ref_accept=='P') echo "<font color='#FF9900'><strong>Pending</strong></font>"; if($row->main_ref_accept=='A') echo "<font color='#006633'><strong>Accepted</strong></font>"; if($row->main_ref_accept=='R') echo "<font color='#FF0000'><strong>Rejected</strong></font>"; ?></font></TD>
		<TD  align="left"><font color="<?=$col?>"> <? echo stripslashes($row->r2fname).' '.stripslashes($row->r2lname); ?></font><br><? if($row->ast_ref1_accept=='P') echo "<font color='#FF9900'><strong>Pending</strong></font>"; if($row->ast_ref1_accept=='A') echo "<font color='#006633'><strong>Accepted</strong></font>"; if($row->ast_ref1_accept=='R') echo "<font color='#FF0000'><strong>Rejected</strong></font>"; ?></font></TD>
		<TD  align="left"><font color="<?=$col?>"> <? echo stripslashes($row->r3fname).' '.stripslashes($row->r3lname); ?></font><br><? if($row->ast_ref2_accept=='P') echo "<font color='#FF9900'><strong>Pending</strong></font>"; if($row->ast_ref2_accept=='A') echo "<font color='#006633'><strong>Accepted</strong></font>"; if($row->ast_ref2_accept=='R') echo "<font color='#FF0000'><strong>Rejected</strong></font>"; ?></font></TD>

 

but when I try to add for example r1lname to select from the database I receive

supplied argument is not a valid MySQL result resource in  

 

Link to comment
Share on other sites

When I change my file and add (I marked it bold) the r1lname and r1fname for example i receive a message:

Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in ../assigned_games.php on line 122

<?	
  	if($_GET["order"])
{
	$order=$_GET["order"];
    $strQueryPerPage="select ag.main_ref_accept,ag.ast_ref1_accept,ag.ast_ref2_accept,[b]r1lname,r1fname[/b],ag.id as agid,g.id,g.gid,d.dname,ht.tname as htname,at.tname as atname from games g inner join divisions d on g.div_id=d.id inner join teams ht on g.home_team_id=ht.id inner join teams at on g.away_team_id=at.id inner join assigned_games ag on g.gid=ag.gid where (main_ref_id=".$_SESSION["UsErId"]." or ast_ref_id1=".$_SESSION["UsErId"]." or ast_ref_id2=".$_SESSION["UsErId"].") and d.dname like '$order%'";
}
else
  	$strQueryPerPage="select ag.main_ref_accept,ag.ast_ref1_accept,ag.ast_ref2_accept,[b]r1lname,r2fname[/b],ag.id as agid,g.id,g.gid,d.dname,ht.tname as htname,at.tname as atname from games g inner join divisions d on g.div_id=d.id inner join teams ht on g.home_team_id=ht.id inner join teams at on g.away_team_id=at.id inner join assigned_games ag on g.gid=ag.gid where main_ref_id=".$_SESSION["UsErId"]." or ast_ref_id1=".$_SESSION["UsErId"]." or ast_ref_id2=".$_SESSION["UsErId"];

if(isset($_GET['sort']))
	$strQueryPerPage.=" order by ".$_GET['sort']." ".$_GET['ordby'];
else
	$strQueryPerPage.=" order by g.id desc";

 

 

Link to comment
Share on other sites

the file assigned_games.php is in the root folder. Here is the code:

 

<?php include("connect.php");
include("admin.session.php");
$LeftLinkSection = 1;
$pagetitle="Assigned Games";

if(isset($_GET['did']))
{
$sql="delete from games where id=".$_GET['did'];
$res=mysql_query($sql);
echo mysql_error();
header('location:message.php?mid=3');
}

?>
<HTML>
<HEAD><title><?=Site_Title; ?></title>
<SCRIPT language="javascript" src="body.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>
</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"><? include("top.php") ?></td></TR>  
  <tr>
  		<td width="20%" valign="top" bgcolor="#1c6995"><? include("left.php"); ?></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"> </TD></TR>
			<TR><TD align="center" width="100%" class="a-l"><?php echo $Message2 ; ?></TD></TR>
	    <TR>
		<? if($msg!="") { ?>
		<TR><TD align="center" width="100%" class="a-l"><font color="red"><b>User Deleted Successfully</b></font></TD></TR>
	    <TR>
		<? } ?>
	      <TD width="100%" class="H1">Manage <?=$pagetitle?></TD>
	    </TR>
			<TR><TD background="images/vdots.gif"><IMG height=1 src="images/spacer.gif" width=1 border=0></TD></TR>
		  <tr>
				<TD>

				<FORM  name="order" action="#" method="post">
    				  <TABLE cellSpacing=0 cellPadding=1 border=0 >
							<tr><td colspan="25" height="20"><b>View By Division Name</b></td></tr>
							<?=$prs_pageing->order();?>
					</TABLE>
				  </form>

<?	
  	if($_GET["order"])
{
	$order=$_GET["order"];
    $strQueryPerPage="select ag.main_ref_accept,ag.ast_ref1_accept,ag.ast_ref2_accept,r1lname,r1fname,ag.id as agid,g.id,g.gid,d.dname,ht.tname as htname,at.tname as atname from games g inner join divisions d on g.div_id=d.id inner join teams ht on g.home_team_id=ht.id inner join teams at on g.away_team_id=at.id inner join assigned_games ag on g.gid=ag.gid where (main_ref_id=".$_SESSION["UsErId"]." or ast_ref_id1=".$_SESSION["UsErId"]." or ast_ref_id2=".$_SESSION["UsErId"].") and d.dname like '$order%'";
}
else
  	$strQueryPerPage="select ag.main_ref_accept,ag.ast_ref1_accept,ag.ast_ref2_accept,r1lname,r2fname,ag.id as agid,g.id,g.gid,d.dname,ht.tname as htname,at.tname as atname from games g inner join divisions d on g.div_id=d.id inner join teams ht on g.home_team_id=ht.id inner join teams at on g.away_team_id=at.id inner join assigned_games ag on g.gid=ag.gid where main_ref_id=".$_SESSION["UsErId"]." or ast_ref_id1=".$_SESSION["UsErId"]." or ast_ref_id2=".$_SESSION["UsErId"];

if(isset($_GET['sort']))
	$strQueryPerPage.=" order by ".$_GET['sort']." ".$_GET['ordby'];
else
	$strQueryPerPage.=" order by g.id desc";

//echo $strQueryPerPage;

$strResultPerPage=mysql_query($strQueryPerPage);
$strTotalPerPage=mysql_affected_rows(); 	
?>
		<div align="center">
		<script type="text/javascript"><!--
			google_ad_client = "pub-4703789267650596";
		/* 728x90, utworzono 10-03-10 */
			google_ad_slot = "0969661517";
			google_ad_width = 728;
			google_ad_height = 90;
		//-->
		</script>
		<script type="text/javascript"
			src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
		</script>
	  
	  <script type="text/javascript"><!--
			google_ad_client = "pub-4703789267650596";
		/* 728x15, utworzono 09-12-14 */
			google_ad_slot = "0676154885";
			google_ad_width = 728;
			google_ad_height = 15;
		//-->
		</script>
		<script type="text/javascript"
			src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
		</script>
	    </div>		
          <FORM name="form2" action="#" method="post">          
          <TABLE width="100%" height="89" border=1 cellSpacing=0 class=t-a>
            <!--DWLayoutTable-->
            <TBODY>
              <TR class="th-a"> 
		     <TD colspan="8">					 
				 <?
					$result=$prs_pageing->number_pageing($strQueryPerPage,15,7);
				?>			  </TD>                 
        	 </TR>		

              <TR class=th-a>
                <TD width="13%" align="left"><a href="assigned_games.php?sort=g.gid&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Game ID</a></TD> 
			<TD width="12%" align="left"><a href="assigned_games.php?sort=d.dname&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Division Name</a></TD> 
		  	<TD width="11%" align="left"><a href="assigned_games.php?sort=ht.tname&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Home Team Name</a></TD>
			<TD width="11%" align="left"><a href="assigned_games.php?sort=at.tname&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Away Team Name</a></TD>
			<TD width="11%" align="left"><a href="assigned_games.php?sort=ag.main_ref_accept&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Main Referee</a></TD>
			<TD width="11%" align="left"><a href="assigned_games.php?sort=ag.ast_ref1_accept&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Assistant Referee 1</a></TD>
			<TD width="11%" align="left"><a href="assigned_games.php?sort=ag.ast_ref2_accept&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Assistant Referee 2</a></TD>
			<TD width="16%" align="center"><span class="style3">Option</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 = "";

        ?>
              <tr bgcolor="<? echo $tr; ?>">
      	    <TD  align="left"><font color="<?=$col?>"><? echo stripslashes($row->gid); ?></font></TD>
		<TD  align="left"><font color="<?=$col?>"><? echo stripslashes($row->dname); ?></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') echo "<font color='#FF9900'><strong>Pending</strong></font>"; if($row->main_ref_accept=='A') echo "<font color='#006633'><strong>Accepted</strong></font>"; if($row->main_ref_accept=='R') echo "<font color='#FF0000'><strong>Rejected</strong></font>"; ?></font></TD>
		<TD  align="left"><font color="<?=$col?>"> <? echo stripslashes($row->r2fname).' '.stripslashes($row->r2lname); ?></font><br><? if($row->ast_ref1_accept=='P') echo "<font color='#FF9900'><strong>Pending</strong></font>"; if($row->ast_ref1_accept=='A') echo "<font color='#006633'><strong>Accepted</strong></font>"; if($row->ast_ref1_accept=='R') echo "<font color='#FF0000'><strong>Rejected</strong></font>"; ?></font></TD>
		<TD  align="left"><font color="<?=$col?>"> <? echo stripslashes($row->r3fname).' '.stripslashes($row->r3lname); ?></font><br><? if($row->ast_ref2_accept=='P') echo "<font color='#FF9900'><strong>Pending</strong></font>"; if($row->ast_ref2_accept=='A') echo "<font color='#006633'><strong>Accepted</strong></font>"; if($row->ast_ref2_accept=='R') echo "<font color='#FF0000'><strong>Rejected</strong></font>"; ?></font></TD>
			<TD align="center"><input name="button" type="button" class="bttn-s" onClick="location.href='view_assigned_game.php?id=<?php echo $row->agid; ?>'" value="View">
		      </TD>
              </TR>
              <?  
		  		$parentary = NULL ;
		  	}	  ?>
            <input type=hidden name="total" value="<? echo $strTotalNewRow; ?>">
            <TR align=center> 
                <TD colSpan=6>
                <?
		 	if(!$strTotalPerPage)
			{
		 ?>
                  <strong>No Game Detail to Display</strong> 
                  <?
		 	}
		 ?>                </TD>
            </TR>
            <TR align=center> 
              <TD colSpan=9>              </TD>
            </TR>
          </TABLE>
        

        </FORM>
				</TD>
		  </TR>
		</TABLE>
	</td>
  </tr>
</TABLE>
</BODY></HTML>

 

that's that file I want to change, because it is not showing me the names

 

Link to comment
Share on other sites

(...)So i think you might wanna put something else after that code and make sure its mysql connect

 

I am out of ideas what else should I add I've spend this night to much time on this site, and my head is out of order right now. :/

Link to comment
Share on other sites

so I should add

 

<?php
mysql_connect("localhost", "admin", "1admin") or die(mysql_error());
echo "Connected to MySQL<br />";
mysql_select_db("test") or die(mysql_error());
echo "Connected to Database";
?>

 

again?

 

Link to comment
Share on other sites

Still the same problem:  :confused: :confused: :confused:

Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in ../assigned_games.php on line 122

 

 

<?php include("connect.php");
include("admin.session.php");
$LeftLinkSection = 1;
$pagetitle="Assigned Games";

if(isset($_GET['did']))
{
$sql="delete from games where id=".$_GET['did'];
$res=mysql_query($sql);
echo mysql_error();
header('location:message.php?mid=3');
}

?>
<HTML>
<HEAD><title><?=Site_Title; ?></title>
<SCRIPT language="javascript" src="body.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>
</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"><? include("top.php") ?></td></TR>  
  <tr>
  		<td width="20%" valign="top" bgcolor="#1c6995"><? include("left.php"); ?></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"> </TD></TR>
			<TR><TD align="center" width="100%" class="a-l"><?php echo $Message2 ; ?></TD></TR>
	    <TR>
		<? if($msg!="") { ?>
		<TR><TD align="center" width="100%" class="a-l"><font color="red"><b>User Deleted Successfully</b></font></TD></TR>
	    <TR>
		<? } ?>
	      <TD width="100%" class="H1">Manage <?=$pagetitle?></TD>
	    </TR>
			<TR><TD background="images/vdots.gif"><IMG height=1 src="images/spacer.gif" width=1 border=0></TD></TR>
		  <tr>
				<TD>

				<FORM  name="order" action="#" method="post">
    				  <TABLE cellSpacing=0 cellPadding=1 border=0 >
							<tr><td colspan="25" height="20"><b>View By Division Name</b></td></tr>
							<?=$prs_pageing->order();?>
					</TABLE>
				  </form>

<?	
  	if($_GET["order"])
{
	$order=$_GET["order"];
    $strQueryPerPage="select ag.main_ref_accept,ag.ast_ref1_accept,ag.ast_ref2_accept,ag.id as agid,g.id,g.gid,d.dname,ht.tname as htname,at.tname as atname from games g inner join divisions d on g.div_id=d.id inner join teams ht on g.home_team_id=ht.id inner join teams at on g.away_team_id=at.id inner join assigned_games ag on g.gid=ag.gid where (main_ref_id=".$_SESSION["UsErId"]." or ast_ref_id1=".$_SESSION["UsErId"]." or ast_ref_id2=".$_SESSION["UsErId"].") and d.dname like '$order%'";
}
else
  	$strQueryPerPage="select ag.main_ref_accept,ag.ast_ref1_accept,ag.ast_ref2_accept,ag.id as agid,g.id,g.gid,d.dname,ht.tname as htname,at.tname as atname from games g inner join divisions d on g.div_id=d.id inner join teams ht on g.home_team_id=ht.id inner join teams at on g.away_team_id=at.id inner join assigned_games ag on g.gid=ag.gid where main_ref_id=".$_SESSION["UsErId"]." or ast_ref_id1=".$_SESSION["UsErId"]." or ast_ref_id2=".$_SESSION["UsErId"];

if(isset($_GET['sort']))
	$strQueryPerPage.=" order by ".$_GET['sort']." ".$_GET['ordby'];
else
	$strQueryPerPage.=" order by g.id desc";

//echo $strQueryPerPage;

$strResultPerPage=mysql_query($strQueryPerPage);
$strTotalPerPage=mysql_affected_rows(); 	
?>
		<div align="center">
		<script type="text/javascript"><!--
			google_ad_client = "pub-4703789267650596";
		/* 728x90, utworzono 10-03-10 */
			google_ad_slot = "0969661517";
			google_ad_width = 728;
			google_ad_height = 90;
		//-->
		</script>
		<script type="text/javascript"
			src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
		</script>
	  
	  <script type="text/javascript"><!--
			google_ad_client = "pub-4703789267650596";
		/* 728x15, utworzono 09-12-14 */
			google_ad_slot = "0676154885";
			google_ad_width = 728;
			google_ad_height = 15;
		//-->
		</script>
		<script type="text/javascript"
			src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
		</script>
	    </div>		
          <FORM name="form2" action="#" method="post">          
          <TABLE width="100%" height="89" border=1 cellSpacing=0 class=t-a>
            <!--DWLayoutTable-->
            <TBODY>
              <TR class="th-a"> 
		     <TD colspan="8">					 
				 <?
					$result=$prs_pageing->number_pageing($strQueryPerPage,15,7);
				?>			  </TD>                 
        	 </TR>		

              <TR class=th-a>
                <TD width="13%" align="left"><a href="assigned_games.php?sort=g.gid&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Game ID</a></TD> 
			<TD width="12%" align="left"><a href="assigned_games.php?sort=d.dname&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Division Name</a></TD> 
		  	<TD width="11%" align="left"><a href="assigned_games.php?sort=ht.tname&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Home Team Name</a></TD>
			<TD width="11%" align="left"><a href="assigned_games.php?sort=at.tname&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Away Team Name</a></TD>
			<TD width="11%" align="left"><a href="assigned_games.php?sort=ag.main_ref_accept&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Main Referee</a></TD>
			<TD width="11%" align="left"><a href="assigned_games.php?sort=ag.ast_ref1_accept&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Assistant Referee 1</a></TD>
			<TD width="11%" align="left"><a href="assigned_games.php?sort=ag.ast_ref2_accept&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Assistant Referee 2</a></TD>
			<TD width="16%" align="center"><span class="style3">Option</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 = "";

        ?>
              <tr bgcolor="<? echo $tr; ?>">
      	    <TD  align="left"><font color="<?=$col?>"><? echo stripslashes($row->gid); ?></font></TD>
		<TD  align="left"><font color="<?=$col?>"><? echo stripslashes($row->dname); ?></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>
	<?php $result=mysql_query($sql_assigned_games);?>
		<TD  align="left"><font color="<?=$col?>"> <? echo stripslashes($row->r1fname).' '.stripslashes($row->r1lname); ?><br><? if($row->main_ref_accept=='P') echo "<font color='#FF9900'><strong>Pending</strong></font>"; if($row->main_ref_accept=='A') echo "<font color='#006633'><strong>Accepted</strong></font>"; if($row->main_ref_accept=='R') echo "<font color='#FF0000'><strong>Rejected</strong></font>"; ?></font></TD>
		<TD  align="left"><font color="<?=$col?>"> <? echo stripslashes($row->r2fname).' '.stripslashes($row->r2lname); ?></font><br><? if($row->ast_ref1_accept=='P') echo "<font color='#FF9900'><strong>Pending</strong></font>"; if($row->ast_ref1_accept=='A') echo "<font color='#006633'><strong>Accepted</strong></font>"; if($row->ast_ref1_accept=='R') echo "<font color='#FF0000'><strong>Rejected</strong></font>"; ?></font></TD>
		<TD  align="left"><font color="<?=$col?>"> <? echo stripslashes($row->r3fname).' '.stripslashes($row->r3lname); ?></font><br><? if($row->ast_ref2_accept=='P') echo "<font color='#FF9900'><strong>Pending</strong></font>"; if($row->ast_ref2_accept=='A') echo "<font color='#006633'><strong>Accepted</strong></font>"; if($row->ast_ref2_accept=='R') echo "<font color='#FF0000'><strong>Rejected</strong></font>"; ?></font></TD>
			<TD align="center"><input name="button" type="button" class="bttn-s" onClick="location.href='view_assigned_game.php?id=<?php echo $row->agid; ?>'" value="View">
		      </TD>
              </TR>
              <?  
		  		$parentary = NULL ;
		  	}	  ?>
            <input type=hidden name="total" value="<? echo $strTotalNewRow; ?>">
            <TR align=center> 
                <TD colSpan=6>
                <?
		 	if(!$strTotalPerPage)
			{
		 ?>
                  <strong>No Game Detail to Display</strong> 
                  <?
		 	}
		 ?>                </TD>
            </TR>
            <TR align=center> 
              <TD colSpan=9>              </TD>
            </TR>
          </TABLE>
        

        </FORM>
				</TD>
		  </TR>
		</TABLE>
	</td>
  </tr>
</TABLE>
</BODY></HTML>

Link to comment
Share on other sites

Your missing a }

 

          <?php

  $tr="#f4f4f4";

  $clr=1;

                        $result=mysql_query($sql_assigned_games);

while($row = mysql_fetch_object($result))

{

 

if($tr=="#FFFFFF")

{

$tr="#efefef";

$col="#000000";

}

else

{

$tr="#FFFFFF";

$col="#000000";

}

$tmpid = $row->id ;

 

$tmpid = "";

}

 

        ?>

 

Link to comment
Share on other sites

the } is on line 169

 

<?php include("connect.php");
include("admin.session.php");
$LeftLinkSection = 1;
$pagetitle="Assigned Games";

if(isset($_GET['did']))
{
$sql="delete from games where id=".$_GET['did'];
$res=mysql_query($sql);
echo mysql_error();
header('location:message.php?mid=3');
}

?>
<HTML>
<HEAD><title><?=Site_Title; ?></title>
<SCRIPT language="javascript" src="body.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>
</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"><? include("top.php") ?></td></TR>  
  <tr>
  		<td width="20%" valign="top" bgcolor="#1c6995"><? include("left.php"); ?></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"> </TD></TR>
			<TR><TD align="center" width="100%" class="a-l"><?php echo $Message2 ; ?></TD></TR>
	    <TR>
		<? if($msg!="") { ?>
		<TR><TD align="center" width="100%" class="a-l"><font color="red"><b>User Deleted Successfully</b></font></TD></TR>
	    <TR>
		<? } ?>
	      <TD width="100%" class="H1">Manage <?=$pagetitle?></TD>
	    </TR>
			<TR><TD background="images/vdots.gif"><IMG height=1 src="images/spacer.gif" width=1 border=0></TD></TR>
		  <tr>
				<TD>

				<FORM  name="order" action="#" method="post">
    				  <TABLE cellSpacing=0 cellPadding=1 border=0 >
							<tr><td colspan="25" height="20"><b>View By Division Name</b></td></tr>
							<?=$prs_pageing->order();?>
					</TABLE>
				  </form>

<?	
  	if($_GET["order"])
{
	$order=$_GET["order"];
    $strQueryPerPage="select ag.main_ref_accept,ag.ast_ref1_accept,ag.ast_ref2_accept,ag.id as agid,g.id,g.gid,d.dname,g.gdate,g.gtime,ht.tname as htname,at.tname as atname from games g inner join divisions d on g.div_id=d.id inner join teams ht on g.home_team_id=ht.id inner join teams at on g.away_team_id=at.id inner join assigned_games ag on g.gid=ag.gid where (main_ref_id=".$_SESSION["UsErId"]." or ast_ref_id1=".$_SESSION["UsErId"]." or ast_ref_id2=".$_SESSION["UsErId"].") and d.dname like '$order%'";
}
else
  	$strQueryPerPage="select ag.main_ref_accept,ag.ast_ref1_accept,ag.ast_ref2_accept,ag.id as agid,g.id,g.gid,d.dname,g.gdate,g.gtime,ht.tname as htname,at.tname as atname from games g inner join divisions d on g.div_id=d.id inner join teams ht on g.home_team_id=ht.id inner join teams at on g.away_team_id=at.id inner join assigned_games ag on g.gid=ag.gid where main_ref_id=".$_SESSION["UsErId"]." or ast_ref_id1=".$_SESSION["UsErId"]." or ast_ref_id2=".$_SESSION["UsErId"];

if(isset($_GET['sort']))
	$strQueryPerPage.=" order by ".$_GET['sort']." ".$_GET['ordby'];
else
	$strQueryPerPage.=" order by g.id desc";

//echo $strQueryPerPage;

$strResultPerPage=mysql_query($strQueryPerPage);
$strTotalPerPage=mysql_affected_rows(); 	
?>
		<div align="center">
		<script type="text/javascript"><!--
			google_ad_client = "pub-4703789267650596";
		/* 728x90, utworzono 10-03-10 */
			google_ad_slot = "0969661517";
			google_ad_width = 728;
			google_ad_height = 90;
		//-->
		</script>
		<script type="text/javascript"
			src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
		</script>
	  
	  <script type="text/javascript"><!--
			google_ad_client = "pub-4703789267650596";
		/* 728x15, utworzono 09-12-14 */
			google_ad_slot = "0676154885";
			google_ad_width = 728;
			google_ad_height = 15;
		//-->
		</script>
		<script type="text/javascript"
			src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
		</script>
	    </div>		
          <FORM name="form2" action="#" method="post">          
          <TABLE width="100%" height="89" border=1 cellSpacing=0 class=t-a>
            <!--DWLayoutTable-->
            <TBODY>
              <TR class="th-a"> 
		     <TD colspan="9">					 
				 <?
					$result=$prs_pageing->number_pageing($strQueryPerPage,15,7);
				?>			  </TD>                 
        	 </TR>		
              <TR class=th-a>
                <TD width="8%" align="left"><a href="manage_games.php?sort=g.gdate&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Game Date</a></TD>
			<TD width="12%" align="left"><a href="assigned_games.php?sort=d.dname&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Division Name</a></TD> 
		  	<TD width="8%" align="left"><a href="manage_games.php?sort=g.gtime&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Game Time</a></TD>				
			<TD width="11%" align="left"><a href="assigned_games.php?sort=ht.tname&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Home Team Name</a></TD>
			<TD width="11%" align="left"><a href="assigned_games.php?sort=at.tname&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Away Team Name</a></TD>
			<TD width="11%" align="left"><a href="assigned_games.php?sort=ag.main_ref_accept&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Main Referee</a></TD>
			<TD width="11%" align="left"><a href="assigned_games.php?sort=ag.ast_ref1_accept&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Assistant Referee 1</a></TD>
			<TD width="11%" align="left"><a href="assigned_games.php?sort=ag.ast_ref2_accept&<? if($_GET['ordby']=='asc' || $_GET['ordby']=='' ) {?>ordby=desc<? } else {?>ordby=asc<? } ?>" class="link2">Assistant Referee 2</a></TD>
			<TD width="16%" align="center"><span class="style3">Option</span></TD>
              </TR>
          <?php
	  $tr="#f4f4f4";
	  $clr=1;
	  $result=mysql_query($sql_assigned_games);
		while($row = mysql_fetch_object($result))
		{

			if($tr=="#FFFFFF")
			{
				$tr="#efefef";
				$col="#000000";
			}
			else
			{
				$tr="#FFFFFF";
				$col="#000000";
			}
			$tmpid = $row->id ;

			$tmpid = "";

        ?>
              <tr bgcolor="<? echo $tr; ?>">
		  <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?>"><? echo stripslashes($row->dname); ?></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') echo "<font color='#FF9900'><strong>Pending</strong></font>"; if($row->main_ref_accept=='A') echo "<font color='#006633'><strong>Accepted</strong></font>"; if($row->main_ref_accept=='R') echo "<font color='#FF0000'><strong>Rejected</strong></font>"; ?></font></TD>
		<TD  align="left"><font color="<?=$col?>"> <? echo stripslashes($row->r2fname).' '.stripslashes($row->r2lname); ?></font><br><? if($row->ast_ref1_accept=='P') echo "<font color='#FF9900'><strong>Pending</strong></font>"; if($row->ast_ref1_accept=='A') echo "<font color='#006633'><strong>Accepted</strong></font>"; if($row->ast_ref1_accept=='R') echo "<font color='#FF0000'><strong>Rejected</strong></font>"; ?></font></TD>
		<TD  align="left"><font color="<?=$col?>"> <? echo stripslashes($row->r3fname).' '.stripslashes($row->r3lname); ?></font><br><? if($row->ast_ref2_accept=='P') echo "<font color='#FF9900'><strong>Pending</strong></font>"; if($row->ast_ref2_accept=='A') echo "<font color='#006633'><strong>Accepted</strong></font>"; if($row->ast_ref2_accept=='R') echo "<font color='#FF0000'><strong>Rejected</strong></font>"; ?></font></TD>
			<TD align="center"><input name="button" type="button" class="bttn-s" onClick="location.href='view_assigned_game.php?id=<?php echo $row->agid; ?>'" value="View">
		      </TD>
              </TR>
              <?  
		  		$parentary = NULL ;
		  	}	  ?>
            <input type=hidden name="total" value="<? echo $strTotalNewRow; ?>">
            <TR align=center> 
                <TD colSpan=8>
                <?
		 	if(!$strTotalPerPage)
			{
		 ?>
                  <strong>No Game Detail to Display</strong> 
                  <?
		 	}
		 ?>                </TD>
            </TR>
            <TR align=center> 
              <TD colSpan=10>              </TD>
            </TR>
          </TABLE>
        

        </FORM>
				</TD>
		  </TR>
		</TABLE>
	</td>
  </tr>
</TABLE>
</BODY></HTML>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.