Jump to content

PHP Used to update database


steven21

Recommended Posts

Hi guys,

 

I have had to make some changes to a database that I updated hockey players stats with. Since doing this I can no longer edit player stats in my admin section of the website. I was wondering if someone could possibly have a look at it for me. It is driving me nuts not being able to fix it.

 

What should happen is: I choose the player from a list of teams to update. Their stats show up on next page in a table for the different competitions they play in (league, cup, play-offs). I could then update the stats and then once pressing the edit button at the bottom, this then updates my SQL database.

 

Can anyone help?

<?php if ($stat==1) { 
// normal players 
$table = "players"; }
else  {
// snl_players
$table ="snl_players"; }

if ($act==edit) {
$query11 = "SELECT * FROM `$table` WHERE `PlayerID` = '$PlayerID'";
$result11 = mysql_query($query11) or die ('Error: Sh2');
$rows = mysql_fetch_array($result11);
$PlayerID = $rows['PlayerID'];
$TeamID = $rows['TeamID'];
$Team = $rows['Team'];
$Player = $rows['Player'];
$Games = $rows['Games'];
$Goals = $rows['Goals'];
$PPGoals = $rows['PPGoals'];
$SHGoals = $rows['SHGoals'];
$Assists = $rows['Assists'];
$PIM = $rows['PIM'];
$Points = $rows['Points'];
$GamesCup = $rows['GamesCup'];
$GoalsCup = $rows['GoalsCup'];
$PPGoalsCup = $rows['PPGoalsCup'];
$SHGoalsCup = $rows['SHGoalsCup'];
$AssistsCup = $rows['AssistsCup'];
$PIMCup = $rows['PIMCup'];
$PointsCup = $rows['PointsCup'];
/* $GamesNPL = $rows['GamesNPL'];
$GoalsNPL = $rows['GoalsNPL'];
$PPGoalsNPL = $rows['PPGoalsNPL'];
$SHGoalsNPL = $rows['SHGoalsNPL'];
$AssistsNPL = $rows['AssistsNPL'];
$PIMNPL = $rows['PIMNPL'];
$PointsNPL = $rows['PointsNPL']; */
$GamesPO = $rows['GamesPO'];
$GoalsPO = $rows['GoalsPO'];
$PPGoalsPO = $rows['PPGoalsPO'];
$SHGoalsPO = $rows['SHGoalsPO'];
$AssistsPO = $rows['AssistsPO'];
$PIMPO = $rows['PIMPO'];
$PointsPO = $rows['PointsPO'];
$Nationality = $rows['Nationality'];

$query11 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'";
$result11 = mysql_query($query11) or die ('Error: Sh2');
$rows = mysql_fetch_array($result11);
$TeamName = $rows['TeamName'];


echo ("<form name=\"form1\" method=\"post\" action=\"playerstats.php?act=editdo&PlayerID=$PlayerID&stat=$stat\">
  <table width=\"80%\" border=\"0\">
    <tr>
      <td width=\"30%\" class=\"data\">Player Name </td>
      <td width=\"70%\"><input name=\"Player\" type=\"text\" id=\"Player\" value=\"$Player\"></td>
    </tr>
    <tr>
      <td class=\"data\">Associated Team ID </td>
      <td class=\"data\">  <select name=\"TeamID\">");
  
$query11 = "SELECT * FROM `teams`";
$result11 = mysql_query($query11) or die ('Error: Sh2');
while ( $rows = mysql_fetch_array($result11) ) {
$TeamName = $rows['TeamName'];	  
$TeamID2 = $rows['TeamID'];	
  
  if ($TeamID==$TeamID2) { echo("    <option value=\"$TeamID2\" selected>$TeamName</option>"); } else {
  echo("    <option value=\"$TeamID2\">$TeamName</option>"); }
  }
  
  
  echo("</select></td>
    </tr>
    <tr>
      <td class=\"data\">Games</td>
      <td><input name=\"Games\" type=\"text\" id=\"Games\" size=\"6\" value=\"$Games\"></td>
    </tr>
    <tr>
      <td class=\"data\">Goals</td>
      <td><input name=\"Goals\" type=\"text\" id=\"Goals\" size=\"6\" value=\"$Goals\"></td>
    </tr>    <tr>
      <td class=\"data\">PPGoals</td>
      <td><input name=\"PPGoals\" type=\"text\" id=\"Goals\" size=\"6\" value=\"$PPGoals\"></td>
    </tr>    <tr>
      <td class=\"data\">SHGoals</td>
      <td><input name=\"SHGoals\" type=\"text\" id=\"Goals\" size=\"6\" value=\"$SHGoals\"></td>
    </tr>
    <tr>
      <td class=\"data\">Assists</td>
      <td><input name=\"Assists\" type=\"text\" id=\"Assists\" size=\"6\" value=\"$Assists\"></td>
    </tr>
    <tr>
      <td class=\"data\">PIM</td>
      <td><input name=\"PIM\" type=\"text\" id=\"PIM\" size=\"6\" value=\"$PIM\"></td>
    </tr>
    <tr>
      <td class=\"data\">Points</td>
      <td><input name=\"Points\" type=\"text\" id=\"Points\" size=\"6\" value=\"$Points\"></td>
    </tr>
    <tr>
      <td class=\"data\">GamesCup</td>
      <td><input name=\"GamesCup\" type=\"text\" id=\"GamesCup\" size=\"6\" value=\"$GamesCup\"></td>
    </tr>  <tr>
      <td class=\"data\">GoalsCup</td>
      <td><input name=\"GoalsCup\" type=\"text\" id=\"GoalsCup\" size=\"6\" value=\"$GoalsCup\"></td>
    </tr>
<tr>
      <td class=\"data\">PPGoalsCup</td>
      <td><input name=\"PPGoalsCup\" type=\"text\" id=\"GoalsCup\" size=\"6\" value=\"$PPGoalsCup\"></td>
    </tr><tr>
      <td class=\"data\">SHGoalsCup</td>
      <td><input name=\"SHGoalsCup\" type=\"text\" id=\"GoalsCup\" size=\"6\" value=\"$SHGoalsCup\"></td>
    </tr>
    <tr>	
      <td class=\"data\">AssistsCup</td>
      <td><input name=\"AssistsCup\" type=\"text\" id=\"AssistsCup\" size=\"6\" value=\"$AssistsCup\"></td>
    </tr>
    <tr>	
      <td class=\"data\">PIMCup</td>
      <td><input name=\"PIMCup\" type=\"text\" id=\"PIMCup\" size=\"6\" value=\"$PIMCup\"></td>
    </tr>	    <tr>	
      <td class=\"data\">PointsCup</td>
      <td><input name=\"PointsCup\" type=\"text\" id=\"PointsCup\" size=\"6\" value=\"$PointsCup\"></td>
    </tr>  "); 

if ($stat==1) { } else { 
echo("
<tr><td class=\"data\">GamesPO</td>
      <td><input name=\"GamesPO\" type=\"text\" id=\"GamesPO\" size=\"6\" value=\"$GamesPO\"></td>
    </tr> <tr>	
      <td class=\"data\">GoalsPO</td>
      <td><input name=\"GoalsPO\" type=\"text\" id=\"GoalsPO\" size=\"6\" value=\"$GoalsPO\"></td>
    </tr>
<tr>	
      <td class=\"data\">PPGoalsPO</td>
      <td><input name=\"PPGoalsPO\" type=\"text\" id=\"GoalsPO\" size=\"6\" value=\"$PPGoalsPO\"></td>
    </tr>
<tr>	
      <td class=\"data\">SHGoalsPO</td>
      <td><input name=\"SHGoalsPO\" type=\"text\" id=\"GoalsPO\" size=\"6\" value=\"$SHGoalsPO\"></td>
    </tr><tr>	
      <td class=\"data\">AssistsPO</td>
      <td><input name=\"AssistsPO\" type=\"text\" id=\"AssistsPO\" size=\"6\" value=\"$AssistsPO\"></td>
    </tr><tr>	
      <td class=\"data\">PIMPO</td>
      <td><input name=\"PIMPO\" type=\"text\" id=\"PIMPO\" size=\"6\" value=\"$PIMPO\"></td>
    </tr><tr>	
      <td class=\"data\">PointsPO</td>
      <td><input name=\"PointsPO\" type=\"text\" id=\"PointsPO\" size=\"6\" value=\"$PointsPO\"></td>
    </tr><tr>	
      <td class=\"data\">Nationality</td>
      <td><input name=\"Nationality\" type=\"text\" id=\"Nationality\" value=\"$Nationality\"></td>
    </tr>	<td class=\"data\"> </td>
      <td> </td>
    </tr>
    <tr>
      <td class=\"data\"> </td>
      <td><input type=\"submit\" name=\"Submit\" value=\"Edit\"></td>
    </tr>
  </table>
</form>"); 
}

if ($stat!=0) {
$query = "UPDATE `players` 
SET `Nationality` = '$Nationality', 
`GamesPO` = '$GamesPO' , 
`AssistsPO` = '$AssistsPO' , 
`GoalsPO` = '$GoalsPO' , 
`PPGoalsPO` = '$PPGoalsPO' , 
`SHGoalsPO` = '$SHGoalsPO' , 
`PointsPO` = '$PointsPO' , 
`PIMPO` = '$PIMPO' ,
`PIM` = '$PIM' ,
`PointsCup` = '$PointsCup' ,
`PIMCup` = '$PIMCup' ,
`AssistsCup` = '$AssistsCup' ,
`GoalsCup` = '$GoalsCup' ,
`PPGoalsCup` = '$PPGoalsCup' ,
`SHGoalsCup` = '$SHGoalsCup' ,
`GamesCup` = '$GamesCup' ,
`Points` = '$Points',
`Assists` = '$Assists' ,
`Goals` = '$Goals' ,
`PPGoals` = '$PPGoals' ,
`SHGoals` = '$SHGoals' ,
`TeamID` = '$TeamID' ,
`Player` = '$Player' ,
`Games` = '$Games' 
WHERE `PlayerID` = '$PlayerID'";
$result = mysql_query($query) or die ("Can't Update");
echo ("The player has been updated.<br><br><a href=\"playerstats.php\"> Go back to the player List</a>");

} else {
$query = "UPDATE `snl_players` 
SET `PIM` = '$PIM' ,
`GamesPO` = '$GamesPO' , 
`AssistsPO` = '$AssistsPO' , 
`GoalsPO` = '$GoalsPO' , 
`PPGoalsPO` = '$PPGoalsPO' , 
`SHGoalsPO` = '$SHGoalsPO' , 
`PointsPO` = '$PointsPO' , 
`PIMPO` = '$PIMPO' ,
`PointsCup` = '$PointsCup' ,
`PIMCup` = '$PIMCup' ,
`AssistsCup` = '$AssistsCup' ,
`GoalsCup` = '$GoalsCup' ,
`PPGoalsCup` = '$PPGoalsCup' ,
`SHGoalsCup` = '$SHGoalsCup' ,
`GamesCup` = '$GamesCup' ,
`Points` = '$Points',
`Assists` = '$Assists' ,
`Goals` = '$Goals' ,
`PPGoals` = '$PPGoals' ,
`SHGoals` = '$SHGoals' ,
`TeamID` = '$TeamID' ,
`Player` = '$Player' ,
`Games` = '$Games' 
WHERE `PlayerID` = '$PlayerID'";
$result = mysql_query($query) or die ("Can't Update");
echo ("The player has been updated.<br><br><a href=\"playerstats.php\"> Go back to the player List</a>");

}
} elseif ($act==teamlist) {
$query112 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'";
$result112 = mysql_query($query112) or die ('Error: Sh2');
$rows2 = mysql_fetch_array($result112);
$TeamName = $rows2['TeamName'];
$Logo = $rows2['Logo'];

if ($Logo!="") { echo("<img src=\"../Images/$Logo\" /><br><br>"); } else { }
echo ("<strong>Edit $TeamName Players</strong><br><br>Click Player Names to edit details<br><br>");
$query11 = "SELECT * FROM `players` WHERE `TeamID` = '$TeamID'";
$result11 = mysql_query($query11) or die ('Error: Sh2');
while ( $rows = mysql_fetch_array($result11) ) {
$Player = $rows['Player'];
$PlayerID = $rows['PlayerID'];
$TeamID = $rows['TeamID'];


echo ("<span class=\"style1\"><a href=\"playerstats.php?act=edit&PlayerID=$PlayerID&stat=1\">$Player</a><br>");
} 
} else {
echo ("Click Team Names to view players<br><br>");
$query11 = "SELECT distinct TeamID FROM `players` ORDER BY `TeamID`";
$result11 = mysql_query($query11) or die ('Error: Sh2');
while ( $rows = mysql_fetch_array($result11) ) {
$TeamID = $rows['TeamID'];

$query112 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'";
$result112 = mysql_query($query112) or die ('Error: Sh2');
$rows2 = mysql_fetch_array($result112);
$TeamName = $rows2['TeamName'];

echo ("<span class=\"style1\"><a href=\"playerstats.php?act=teamlist&TeamID=$TeamID&stat=1\">$TeamName</a><br>");
} echo ("<a name=\"snl\"></a><br><strong><a href=\"snlplayerstats.php\">SNL Teams</a></strong><br><br>");

}

?>

 

Link to comment
https://forums.phpfreaks.com/topic/209964-php-used-to-update-database/
Share on other sites

As I am editing the stats on the playerstats page the PHP action at the top shows:

 

playerstats.php?act=edit&PlayerID=1

 

After I click on the edit button to update the database it goes to:

 

playerstats.php?act=editdo&PlayerID=1&stat=

 

But it is taking me back to a list of the teams (when I click on each team it shows me their players that I can edit)

you have

if ($act==edit) {

and

} elseif ($act==teamlist) {

 

where is $act being set?

 

You need to set $act. And you need to quote the strings i.e. 'edit' and 'teamlist'

if (isset($_GET['act']))
{
$act = $_GET['act'];
}

//code here
//change ifs
//i.e.
if ($act=='edit') {
//and
} elseif ($act=='teamlist') {

 

and then after that, you said after you click the edit button the url is "playerstats.php?act=editdo&PlayerID=1&stat="

You have no if if command to execute code if act = editdo.

they are the separate bits of code which definitely need changing,

 

put this up the start of the script, somewhere before "if ($act==edit)"

if (isset($_GET['act']))
{
$act = $_GET['act'];
}

 

change

if ($act==edit) {

to

if ($act=='edit') {

 

and change

} elseif ($act==teamlist) {

to

} elseif ($act=='teamlist') {

thats because you have no PHP code triggered if act = editdo, and so it is triggering the default "else" statement which is the team names "Click Team Names to view players" etc etc.

 

You need to add a block of code which handles your editdo function and updates the database.

you'll need to add an if statement

i.e. insert another elseif before the last else.

etc
etc
etc
} else if ($act == 'editdo') {
exit("EDIT DO, rara, get posted values and update database etc etc. You'll have to code this part to perform the function you want.");
} else {
echo ("Click Team Names to view players<br><br>");
etc
etc
etc

the etc etc etc signifies other blocks of your code.

Excuse me lack of knowledge - I programmed this 3 or 4 years ago and haven't been near PHP since.

 

the line :

 exit("EDIT DO, rara, get posted values and update database etc etc. You'll have to code this part to perform the function you want.");

 

What am I putting in the "  "?

 

Would I be correct in saying it goes before this else statement?

 

else {
echo ("Click Team Names to view players<br><br>");
$query11 = "SELECT distinct TeamID FROM `players` ORDER BY `TeamID`";
$result11 = mysql_query($query11) or die ('Error: Sh2');
while ( $rows = mysql_fetch_array($result11) ) {
$TeamID = $rows['TeamID'];

$query112 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'";
$result112 = mysql_query($query112) or die ('Error: Sh2');
$rows2 = mysql_fetch_array($result112);
$TeamName = $rows2['TeamName'];

echo ("<span class=\"style1\"><a href=\"playerstats.php?act=teamlist&TeamID=$TeamID&stat=1\">$TeamName</a><br>");
}

I have another section in my admin section that updates my database with the league results - I put in each teams games played, wins, draws, goals, etc and it updates the database. This still works, I am trying to look at this section to help but still not seeing it.

 

This is just for reference - as this DOES update my database for the league tables.

 

<?php echo("<form action=\"auth.php\" method=\"post\" name=\"login\" id=\"login\">
                                      Username: <input name=\"PHP_AUTH_USER\" type=\"text\" id=\"PHP_AUTH_USER\" value=\"username\"><br><br>
                    Password: <input name=\"PHP_AUTH_PW\" type=\"password\" id=\"PHP_AUTH_PW\" value=\"\"><br>
                    <input type=\"submit\" name=\"Submit\" value=\"Login\"> 
                            
                  </form>"); ?></span></div>
      </nobr>
      <div align="center">
      <p class="left"> </p>
    <br>
    <br>
  </td>
<td rowspan="2">
<div align="center"><img src="images/top01.gif" width="597" height="24" alt="" border="0"></div>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td> </td>
<td>
<p style="color: #1F269D; font-size: 20px; margin-left: 0px;"><b>Edit League Tables</b>:</p>
<?php if ($act==edit) {
// edit
$query11 = "SELECT * FROM `$table` WHERE `TeamID` = '$TeamID'";
$result11 = mysql_query($query11) or die ('Error: Sh2');
$rows = mysql_fetch_array($result11);
$TeamID = $rows['TeamID'];
$Games = $rows['Games'];
$Won = $rows['Won'];
$Loss = $rows['Loss'];
$Tied = $rows['Tied'];
$OTLoss = $rows['OTLoss'];
$Points = $rows['Points'];
$GoalsFor = $rows['GoalsFor'];
$GoalsAgainst = $rows['GoalsAgainst'];

if ($table==eliteleague){
} elseif ($table==scottishleague) { } elseif ($table==npl) { }else {
$Group = $rows['Group']; }

$query111 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'";
$result111 = mysql_query($query111) or die ('Error: Sh2');
$rows1 = mysql_fetch_array($result111);
$TeamName = $rows1['TeamName'];

echo ("<strong>Edit Stats for $TeamName</strong><br><br>");

echo ("<form name=\"form1\" method=\"post\" action=\"leaguestats.php?act=editdo&TeamID=$TeamID&table=$table\">
  <table width=\"80%\" border=\"0\">
    <tr>
      <td width=\"30%\" class=\"data\">Games </td>
      <td width=\"70%\"><input name=\"Games\" type=\"text\" id=\"Games\" value=\"$Games\" size=\"6\"></td>
    </tr>
    <tr>
      <td class=\"data\">Won </td>
      <td><input name=\"Won\" type=\"text\" id=\"Won\" value=\"$Won\" size=\"6\"></td>
    </tr>
    <tr>
      <td class=\"data\">Loss</td>
      <td><input name=\"Loss\" type=\"text\" id=\"Loss\" value=\"$Loss\" size=\"6\"></td>
    </tr>

    <tr>
      <td class=\"data\">Tied</td>
      <td><input name=\"Tied\" type=\"text\" id=\"Tied\" value=\"$Tied\" size=\"6\"></td>
    </tr>
    <tr>
      <td class=\"data\">Points</td>
      <td><input name=\"Points\" type=\"text\" id=\"Points\" value=\"$Points\" size=\"6\"></td>
    </tr>
    <tr>
      <td class=\"data\">OTLoss</td>
      <td><input name=\"OTLoss\" type=\"OTLoss\" id=\"OTLoss\" value=\"$OTLoss\" size=\"6\"></td>
    </tr>
    <tr>
      <td class=\"data\">GoalsFor</td>
      <td><input name=\"GoalsFor\" type=\"text\" id=\"GoalsFor\" value=\"$GoalsFor\" size=\"6\"></td>
    </tr>
    <tr>
      <td class=\"data\">GoalsAgainst</td>
      <td><input name=\"GoalsAgainst\" type=\"text\" id=\"GoalsAgainst\" value=\"$GoalsAgainst\" size=\"6\"></td>
    </tr>");

if ($table==eliteleague){
} elseif ($table==scottishleague) { } elseif ($table==npl) { }else {
echo("<tr>
      <td class=\"data\">Group</td>
      <td><input name=\"Group\" type=\"text\" id=\"Group\" value=\"$Group\" size=\"6\"></td>
    </tr>"); }	

    echo("<tr>
      <td class=\"data\"> </td>
      <td> </td>
    </tr>
    <tr>
      <td class=\"data\"> </td>
      <td><input type=\"submit\" name=\"Submit\" value=\"Edit\"></td>
    </tr>
  </table>
</form>");

} elseif ($act==editdo) {
// do edit
if ($table==eliteleague){
$query = "UPDATE `$table` SET `Games` = '$Games', `Won` = '$Won' , `Loss` = '$Loss' , `Tied` = '$Tied' , `OTLoss` = '$OTLoss' , `GoalsFor` = '$GoalsFor' , `GoalsAgainst` = '$GoalsAgainst' , `Points` = '$Points' WHERE `TeamID` = '$TeamID'";
$result = mysql_query($query) or die ("Can't Update");
echo ("The stats have been updated.<br><br><a href=\"leaguestats.php\"> Go back to League/Cup/PO List</a>");

} elseif ($table==scottishleague) { 
$query = "UPDATE `$table` SET `Games` = '$Games', `Won` = '$Won' , `Loss` = '$Loss' , `Tied` = '$Tied' , `OTLoss` = '$OTLoss' , `GoalsFor` = '$GoalsFor' , `GoalsAgainst` = '$GoalsAgainst' , `Points` = '$Points' WHERE `TeamID` = '$TeamID'";
$result = mysql_query($query) or die ("Can't Update");
echo ("The stats have been updated.<br><br><a href=\"leaguestats.php\"> Go back to League/Cup/PO List</a>"); 

} elseif ($table==npl) { 
$query = "UPDATE `$table` SET `Games` = '$Games', `Won` = '$Won' , `Loss` = '$Loss' , `Tied` = '$Tied' , `OTLoss` = '$OTLoss' , `GoalsFor` = '$GoalsFor' , `GoalsAgainst` = '$GoalsAgainst' , `Points` = '$Points' WHERE `TeamID` = '$TeamID'";
$result = mysql_query($query) or die ("Can't Update");
echo ("The stats have been updated.<br><br><a href=\"leaguestats.php\"> Go back to League/Cup/PO List</a>"); 

} else {
$query = "UPDATE `$table` SET `Games` = '$Games', `Won` = '$Won' , `Loss` = '$Loss' , `Tied` = '$Tied' , `OTLoss` = '$OTLoss' , `GoalsFor` = '$GoalsFor' , `GoalsAgainst` = '$GoalsAgainst' , `Points` = '$Points' , `Group` = '$Group' WHERE `TeamID` = '$TeamID'";
$result = mysql_query($query) or die ("Can't Update");
echo ("The stats have been updated.<br><br><a href=\"leaguestats.php\"> Go back to League/Cup/PO List</a>");
}

} elseif ($act==view) {
// show league
echo ("Edit Teams in $table<br><br>");

$query11 = "SELECT * FROM `$table`";
$result11 = mysql_query($query11) or die ('Error: Sh2');
while ( $rows = mysql_fetch_array($result11) ) {
$TeamID = $rows['TeamID'];

$query111 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'";
$result111 = mysql_query($query111) or die ('Error: Sh2');
$rows1 = mysql_fetch_array($result111);
$TeamName = $rows1['TeamName'];

echo ("<a href=\"leaguestats.php?act=edit&TeamID=$TeamID&table=$table\">$TeamName</a><br>");

}
} else {
// show all leagues/cups
echo ("Edit Leagues/Cups/Playoffs. Select from below:<br><br>
<a href=\"leaguestats.php?act=view&table=elitecup\">Edit Elite Cup</a><br>
<a href=\"leaguestats.php?act=view&table=eliteleague\">Edit Elite League</a><br>
<a href=\"leaguestats.php?act=view&table=elitepo\">Edit Elite Play Offs</a><br>
<a href=\"leaguestats.php?act=view&table=scottishcup\">Edit Scottish Cup</a><br>
<a href=\"leaguestats.php?act=view&table=scottishleague\">Edit Celtic Cup</a><br>
<a href=\"leaguestats.php?act=view&table=snl\">Edit SNL</a><br>
<a href=\"leaguestats.php?act=view&table=scottishpo\">Edit Scottish Play Offs</a><br>
<a href=\"leaguestats.php?act=view&table=npl\">Edit NPL</a><br>");

}
?>

 

I got your problem.  Take a backup of your code and place this.

 

<?php 
session_start();

if( isset($_SESSION['msg']) )
  echo  $_SESSION['msg'];

error_reporting(E_ALL);
ini_set("display_errors", 1); 


if (isset($_REQUEST['act']))
{
  $act = $_REQUEST['act'];
}
if (isset($_REQUEST['stat']))
{
  $stat = $_REQUEST['stat'];
}


if ($stat==1) { 
  // normal players 
  $table = "players"; 
}
else  {
  // snl_players
  $table ="snl_players"; 
}

if (strcmp($act, 'edit')==0) 
{
  $query11 = "SELECT * FROM `$table` WHERE `PlayerID` = '$PlayerID'";
  $result11 = mysql_query($query11) or die (mysql_error());
  $rows = mysql_fetch_array($result11);
  $PlayerID = $rows['PlayerID'];
  $TeamID = $rows['TeamID'];
  $Team = $rows['Team'];
  $Player = $rows['Player'];
  $Games = $rows['Games'];
  $Goals = $rows['Goals'];
  $PPGoals = $rows['PPGoals'];
  $SHGoals = $rows['SHGoals'];
  $Assists = $rows['Assists'];
  $PIM = $rows['PIM'];
  $Points = $rows['Points'];
  $GamesCup = $rows['GamesCup'];
  $GoalsCup = $rows['GoalsCup'];
  $PPGoalsCup = $rows['PPGoalsCup'];
  $SHGoalsCup = $rows['SHGoalsCup'];
  $AssistsCup = $rows['AssistsCup'];
  $PIMCup = $rows['PIMCup'];
  $PointsCup = $rows['PointsCup'];
  /* $GamesNPL = $rows['GamesNPL'];
  $GoalsNPL = $rows['GoalsNPL'];
  $PPGoalsNPL = $rows['PPGoalsNPL'];
  $SHGoalsNPL = $rows['SHGoalsNPL'];
  $AssistsNPL = $rows['AssistsNPL'];
  $PIMNPL = $rows['PIMNPL'];
  $PointsNPL = $rows['PointsNPL']; */
  $GamesPO = $rows['GamesPO'];
  $GoalsPO = $rows['GoalsPO'];
  $PPGoalsPO = $rows['PPGoalsPO'];
  $SHGoalsPO = $rows['SHGoalsPO'];
  $AssistsPO = $rows['AssistsPO'];
  $PIMPO = $rows['PIMPO'];
  $PointsPO = $rows['PointsPO'];
  $Nationality = $rows['Nationality'];
  
  $query11 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'";
  $result11 = mysql_query($query11) or die (mysql_error());
  $rows = mysql_fetch_array($result11);
  $TeamName = $rows['TeamName'];
  
  
  echo ("<form name=\"form1\" method=\"post\" action=\"playerstats.php?act=editdo&PlayerID=$PlayerID&stat=$stat\">
    <table width=\"80%\" border=\"0\">
      <tr>
        <td width=\"30%\" class=\"data\">Player Name </td>
        <td width=\"70%\"><input name=\"Player\" type=\"text\" id=\"Player\" value=\"$Player\"></td>
      </tr>
      <tr>
        <td class=\"data\">Associated Team ID </td>
        <td class=\"data\">  <select name=\"TeamID\">");
  
  	
  
    
    $query11 = "SELECT * FROM `teams`";
    $result11 = mysql_query($query11) or die (mysql_error());
    while ( $rows = mysql_fetch_array($result11) ) 
    {
      $TeamName = $rows['TeamName'];    
      $TeamID2 = $rows['TeamID'];   
      if (strcmp($TeamID,$TeamID2)==0) { echo("    <option value=\"$TeamID2\" selected>$TeamName</option>"); } 
      else {  echo("    <option value=\"$TeamID2\">$TeamName</option>"); }
    }
      
    echo("</select></td>
      </tr>
      <tr>
        <td class=\"data\">Games</td>
        <td><input name=\"Games\" type=\"text\" id=\"Games\" size=\"6\" value=\"$Games\"></td>
      </tr>
      <tr>
        <td class=\"data\">Goals</td>
        <td><input name=\"Goals\" type=\"text\" id=\"Goals\" size=\"6\" value=\"$Goals\"></td>
      </tr>    <tr>
        <td class=\"data\">PPGoals</td>
        <td><input name=\"PPGoals\" type=\"text\" id=\"Goals\" size=\"6\" value=\"$PPGoals\"></td>
      </tr>    <tr>
        <td class=\"data\">SHGoals</td>
        <td><input name=\"SHGoals\" type=\"text\" id=\"Goals\" size=\"6\" value=\"$SHGoals\"></td>
      </tr>
      <tr>
        <td class=\"data\">Assists</td>
        <td><input name=\"Assists\" type=\"text\" id=\"Assists\" size=\"6\" value=\"$Assists\"></td>
      </tr>  
      <tr>
        <td class=\"data\">PIM</td>
        <td><input name=\"PIM\" type=\"text\" id=\"PIM\" size=\"6\" value=\"$PIM\"></td>
      </tr>
      <tr>
        <td class=\"data\">Points</td>
        <td><input name=\"Points\" type=\"text\" id=\"Points\" size=\"6\" value=\"$Points\"></td>
      </tr>
      <tr>
        <td class=\"data\">GamesCup</td>
        <td><input name=\"GamesCup\" type=\"text\" id=\"GamesCup\" size=\"6\" value=\"$GamesCup\"></td>
      </tr>  <tr>
        <td class=\"data\">GoalsCup</td>
        <td><input name=\"GoalsCup\" type=\"text\" id=\"GoalsCup\" size=\"6\" value=\"$GoalsCup\"></td>
      </tr>  
      <tr>
        <td class=\"data\">PPGoalsCup</td>
        <td><input name=\"PPGoalsCup\" type=\"text\" id=\"GoalsCup\" size=\"6\" value=\"$PPGoalsCup\"></td>
      </tr><tr>
        <td class=\"data\">SHGoalsCup</td>
        <td><input name=\"SHGoalsCup\" type=\"text\" id=\"GoalsCup\" size=\"6\" value=\"$SHGoalsCup\"></td>
      </tr>
      <tr>  
        <td class=\"data\">AssistsCup</td>
        <td><input name=\"AssistsCup\" type=\"text\" id=\"AssistsCup\" size=\"6\" value=\"$AssistsCup\"></td>
      </tr>  
      <tr>  
        <td class=\"data\">PIMCup</td>
        <td><input name=\"PIMCup\" type=\"text\" id=\"PIMCup\" size=\"6\" value=\"$PIMCup\"></td>
      </tr>  
      <tr>  
        <td class=\"data\">PointsCup</td>
        <td><input name=\"PointsCup\" type=\"text\" id=\"PointsCup\" size=\"6\" value=\"$PointsCup\"></td>
      </tr>  "); 
    
  if ($stat==1) { } 
  else {   
  echo("  
  <tr><td class=\"data\">GamesPO</td>
        <td><input name=\"GamesPO\" type=\"text\" id=\"GamesPO\" size=\"6\" value=\"$GamesPO\"></td>
      </tr> <tr>  
        <td class=\"data\">GoalsPO</td>
        <td><input name=\"GoalsPO\" type=\"text\" id=\"GoalsPO\" size=\"6\" value=\"$GoalsPO\"></td>
      </tr>
  <tr>  
        <td class=\"data\">PPGoalsPO</td>
        <td><input name=\"PPGoalsPO\" type=\"text\" id=\"GoalsPO\" size=\"6\" value=\"$PPGoalsPO\"></td>
      </tr>  
  <tr>
  
  	
  
  
        <td class=\"data\">SHGoalsPO</td>
        <td><input name=\"SHGoalsPO\" type=\"text\" id=\"GoalsPO\" size=\"6\" value=\"$SHGoalsPO\"></td>
      </tr><tr>
  
  	
  
  
        <td class=\"data\">AssistsPO</td>
        <td><input name=\"AssistsPO\" type=\"text\" id=\"AssistsPO\" size=\"6\" value=\"$AssistsPO\"></td>
      </tr><tr>
  
  	
  
  
        <td class=\"data\">PIMPO</td>
        <td><input name=\"PIMPO\" type=\"text\" id=\"PIMPO\" size=\"6\" value=\"$PIMPO\"></td>
      </tr><tr>
  
  	
  
  
        <td class=\"data\">PointsPO</td>
        <td><input name=\"PointsPO\" type=\"text\" id=\"PointsPO\" size=\"6\" value=\"$PointsPO\"></td>
      </tr><tr>
  
  	
  
  
        <td class=\"data\">Nationality</td>
        <td><input name=\"Nationality\" type=\"text\" id=\"Nationality\" value=\"$Nationality\"></td>
      </tr>
  
  	
  
  <td class=\"data\"> </td>
        <td> </td>
      </tr>
      <tr>
        <td class=\"data\"> </td>
        <td><input type=\"submit\" name=\"Submit\" value=\"Edit\"></td>
      </tr>
    </table>
  </form>"); 
  }
  
  if ($stat!=0) {
  $query = "UPDATE `players` 
  SET `Nationality` = '$Nationality', 
  `GamesPO` = '$GamesPO' , 
  `AssistsPO` = '$AssistsPO' , 
  `GoalsPO` = '$GoalsPO' , 
  `PPGoalsPO` = '$PPGoalsPO' , 
  `SHGoalsPO` = '$SHGoalsPO' , 
  `PointsPO` = '$PointsPO' , 
  `PIMPO` = '$PIMPO' ,
  `PIM` = '$PIM' ,
  `PointsCup` = '$PointsCup' ,
  `PIMCup` = '$PIMCup' ,
  `AssistsCup` = '$AssistsCup' ,
  `GoalsCup` = '$GoalsCup' ,
  `PPGoalsCup` = '$PPGoalsCup' ,
  `SHGoalsCup` = '$SHGoalsCup' ,
  `GamesCup` = '$GamesCup' ,
  `Points` = '$Points',
  `Assists` = '$Assists' ,
  `Goals` = '$Goals' ,
  `PPGoals` = '$PPGoals' ,
  `SHGoals` = '$SHGoals' ,
  `TeamID` = '$TeamID' ,
  `Player` = '$Player' ,
  `Games` = '$Games' 
  WHERE `PlayerID` = '$PlayerID'";
  $result = mysql_query($query) die (mysql_error());
  $_SESSION['msg'] = "The player has been updated. No. of records updated, ", mysql_affected_rows();
  echo ("The player has been updated. No. of records updated, ", mysql_affected_rows(),"<br><br><a href=\"playerstats.php\"> Go back to the player List</a>");
  
  } 
  else {
  $query = "UPDATE `snl_players` 
  SET `PIM` = '$PIM' ,
  `GamesPO` = '$GamesPO' , 
  `AssistsPO` = '$AssistsPO' , 
  `GoalsPO` = '$GoalsPO' , 
  `PPGoalsPO` = '$PPGoalsPO' , 
  `SHGoalsPO` = '$SHGoalsPO' , 
  `PointsPO` = '$PointsPO' , 
  `PIMPO` = '$PIMPO' ,
  `PointsCup` = '$PointsCup' ,
  `PIMCup` = '$PIMCup' ,
  `AssistsCup` = '$AssistsCup' ,
  `GoalsCup` = '$GoalsCup' ,
  `PPGoalsCup` = '$PPGoalsCup' ,
  `SHGoalsCup` = '$SHGoalsCup' ,
  `GamesCup` = '$GamesCup' ,
  `Points` = '$Points',
  `Assists` = '$Assists' ,
  `Goals` = '$Goals' ,
  `PPGoals` = '$PPGoals' ,
  `SHGoals` = '$SHGoals' ,
  `TeamID` = '$TeamID' ,
  `Player` = '$Player' ,
  `Games` = '$Games' 
  WHERE `PlayerID` = '$PlayerID'";
  $result = mysql_query($query) or  die (mysql_error());
  $_SESSION['msg'] = "The player has been updated. No. of records updated, ", mysql_affected_rows();
  echo ("The player has been updated. No. of records updated, ", mysql_affected_rows(),"<br><br><a href=\"playerstats.php\"> Go back to the player List</a>");  
  }
} 
elseif (strcmp($act,'teamlist')==0) {
  $query112 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'";
  $result112 = mysql_query($query112) or  die (mysql_error());
  $rows2 = mysql_fetch_array($result112);
  $TeamName = $rows2['TeamName'];
  $Logo = $rows2['Logo'];
  
  if ($Logo!="") { echo("<img src=\"../Images/$Logo\" /><br><br>"); } else { }
  echo ("<strong>Edit $TeamName Players</strong><br><br>Click Player Names to edit details<br><br>");
  $query11 = "SELECT * FROM `players` WHERE `TeamID` = '$TeamID'";
  $result11 = mysql_query($query11) or  die (mysql_error());
  while ( $rows = mysql_fetch_array($result11) ) {
  $Player = $rows['Player'];
  $PlayerID = $rows['PlayerID'];
  $TeamID = $rows['TeamID'];
  
  
  echo ("<span class=\"style1\"><a href=\"playerstats.php?act=edit&PlayerID=$PlayerID&stat=1\">$Player</a><br>");
  } 
} 
else {
  echo ("Click Team Names to view players<br><br>");
  $query11 = "SELECT distinct TeamID FROM `players` ORDER BY `TeamID`";
  $result11 = mysql_query($query11) or    die (mysql_error());
  $TeamID_in = "";
  while ( $rows = mysql_fetch_array($result11) ) 
  {
    //$TeamID = $rows['TeamID'];
    $TeamID_in .= "'".$rows['TeamID']."',"; 
  }    
  (substr($TeamID_in,-1) == ",") ? substr($TeamID_in, 0, -1) : $TeamID_in;
  
  
  //  $query112 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'";
    $query112 = "SELECT * FROM `teams` WHERE `TeamID` IN ($TeamID_in)";
    $result112 = mysql_query($query112) or  die (mysql_error());
    $rows2 = mysql_fetch_array($result112);
    $TeamName = $rows2['TeamName'];
    
    echo ("<span class=\"style1\"><a href=\"playerstats.php?act=teamlist&TeamID=$TeamID&stat=1\">$TeamName</a><br>");
  } 
  echo ("<a name=\"snl\"></a><br><strong><a href=\"snlplayerstats.php\">SNL Teams</a></strong><br><br>");

}

?>

I got your problem.  Take a backup of your code and place this.

 

Just tried it but when I try to go to the link to edit my player stats I get this

 

Parse error: syntax error, unexpected T_EXIT in C:\Domains\fifeflyers.co.uk\wwwroot\admin\snlplayerstats.php on line 314

Here you go:

<?php include('../functions.php'); echo dbconnect(); include ('logincheck.php'); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Fife Flyers - Admin Area</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>

<body leftmargin=0 topmargin=0 marginheight="0" marginwidth="0" bgcolor="#ffffff">

<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">
<tr valign="top">
<td width="50%" background="images/bg.gif"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>
<td valign="bottom" background="images/bg_left.gif"><img src="images/bg_left.gif" alt="" width="17" height="16" border="0"></td>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="780" height="107">
<tr valign="bottom">
<td background="images/fon_top.gif"> </td>
<td width="673" background="images/fon_top.gif">
<table border="0" cellpadding="0" cellspacing="0" background="">
<tr valign="bottom">
<td>
<!-- but act -->
<table border="0" cellpadding="0" cellspacing="0">
<tr valign="bottom">
<td><img src="images/b_left_a.gif" width="9" height="37" alt="" border="0"></td>
<td background="images/b_fon_a.gif"><p class="menu01"><a href="index2.php">ADMIN  </a></p></td>
<td><img src="images/b_right_a.gif" width="9" height="37" alt="" border="0"></td>
</tr>
</table>
<!-- /but act -->	</td>
</tr>
</table>
</td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="780" height="107">
<tr valign="top">
  <td bgcolor="#E7BD1D"><table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr>
        <td bgcolor="#E7BD1D"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td> </td>
            </tr>
        </table></td>
      </tr>
    </table>
      <div align="center"></div>
    <div align="center"><img src="images/title01.gif" width="183" height="35" alt="" border="0"></div>
    <nobr class="right">
      <div style="padding-top: 10px; padding-left: 20px;"><span class="right"><?php echo("<form action=\"auth.php\" method=\"post\" name=\"login\" id=\"login\">
                                      Username: <input name=\"PHP_AUTH_USER\" type=\"text\" id=\"PHP_AUTH_USER\" value=\"username\"><br><br>
                    Password: <input name=\"PHP_AUTH_PW\" type=\"password\" id=\"PHP_AUTH_PW\" value=\"\"><br>
                    <input type=\"submit\" name=\"Submit\" value=\"Login\"> 
                            
                  </form>"); ?></span></div>
      </nobr>
      <div align="center">
      <p class="left"> </p>
    <br>
    <br>
  </td>
<td rowspan="2">
<div align="center"><img src="images/top01.gif" width="597" height="24" alt="" border="0"></div>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td> </td>
<td>
<p style="color: #1F269D; font-size: 20px; margin-left: 0px;"><b>Edit  Player Stats:</b></p>
<p style="color: #1F269D; font-size: 20px; margin-left: 0px;"><span style="color: #1F269D; font-size: 16px; margin-left: 0px;">Powerplay Goals & Shorthanded Goals are not to be added to points total - all goals scored should be added to goals column and these are added to total points. </span></p>
<?php 
session_start();

if( isset($_SESSION['msg']) )
  echo  $_SESSION['msg'];

error_reporting(E_ALL);
ini_set("display_errors", 1); 


if (isset($_REQUEST['act']))
{
  $act = $_REQUEST['act'];
}
if (isset($_REQUEST['stat']))
{
  $stat = $_REQUEST['stat'];
}


if ($stat==1) { 
  // normal players 
  $table = "players"; 
}
else  {
  // snl_players
  $table ="snl_players"; 
}

if (strcmp($act, 'edit')==0) 
{
  $query11 = "SELECT * FROM `$table` WHERE `PlayerID` = '$PlayerID'";
  $result11 = mysql_query($query11) or die (mysql_error());
  $rows = mysql_fetch_array($result11);
  $PlayerID = $rows['PlayerID'];
  $TeamID = $rows['TeamID'];
  $Team = $rows['Team'];
  $Player = $rows['Player'];
  $Games = $rows['Games'];
  $Goals = $rows['Goals'];
  $PPGoals = $rows['PPGoals'];
  $SHGoals = $rows['SHGoals'];
  $Assists = $rows['Assists'];
  $PIM = $rows['PIM'];
  $Points = $rows['Points'];
  $GamesCup = $rows['GamesCup'];
  $GoalsCup = $rows['GoalsCup'];
  $PPGoalsCup = $rows['PPGoalsCup'];
  $SHGoalsCup = $rows['SHGoalsCup'];
  $AssistsCup = $rows['AssistsCup'];
  $PIMCup = $rows['PIMCup'];
  $PointsCup = $rows['PointsCup'];
  /* $GamesNPL = $rows['GamesNPL'];
  $GoalsNPL = $rows['GoalsNPL'];
  $PPGoalsNPL = $rows['PPGoalsNPL'];
  $SHGoalsNPL = $rows['SHGoalsNPL'];
  $AssistsNPL = $rows['AssistsNPL'];
  $PIMNPL = $rows['PIMNPL'];
  $PointsNPL = $rows['PointsNPL']; */
  $GamesPO = $rows['GamesPO'];
  $GoalsPO = $rows['GoalsPO'];
  $PPGoalsPO = $rows['PPGoalsPO'];
  $SHGoalsPO = $rows['SHGoalsPO'];
  $AssistsPO = $rows['AssistsPO'];
  $PIMPO = $rows['PIMPO'];
  $PointsPO = $rows['PointsPO'];
  $Nationality = $rows['Nationality'];
  
  $query11 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'";
  $result11 = mysql_query($query11) or die (mysql_error());
  $rows = mysql_fetch_array($result11);
  $TeamName = $rows['TeamName'];
  
  
  echo ("<form name=\"form1\" method=\"post\" action=\"playerstats.php?act=editdo&PlayerID=$PlayerID&stat=$stat\">
    <table width=\"80%\" border=\"0\">
      <tr>
        <td width=\"30%\" class=\"data\">Player Name </td>
        <td width=\"70%\"><input name=\"Player\" type=\"text\" id=\"Player\" value=\"$Player\"></td>
      </tr>
      <tr>
        <td class=\"data\">Associated Team ID </td>
        <td class=\"data\">  <select name=\"TeamID\">");
  
  	
  
    
    $query11 = "SELECT * FROM `teams`";
    $result11 = mysql_query($query11) or die (mysql_error());
    while ( $rows = mysql_fetch_array($result11) ) 
    {
      $TeamName = $rows['TeamName'];    
      $TeamID2 = $rows['TeamID'];   
      if (strcmp($TeamID,$TeamID2)==0) { echo("    <option value=\"$TeamID2\" selected>$TeamName</option>"); } 
      else {  echo("    <option value=\"$TeamID2\">$TeamName</option>"); }
    }
      
    echo("</select></td>
      </tr>
      <tr>
        <td class=\"data\">Games</td>
        <td><input name=\"Games\" type=\"text\" id=\"Games\" size=\"6\" value=\"$Games\"></td>
      </tr>
      <tr>
        <td class=\"data\">Goals</td>
        <td><input name=\"Goals\" type=\"text\" id=\"Goals\" size=\"6\" value=\"$Goals\"></td>
      </tr>    <tr>
        <td class=\"data\">PPGoals</td>
        <td><input name=\"PPGoals\" type=\"text\" id=\"Goals\" size=\"6\" value=\"$PPGoals\"></td>
      </tr>    <tr>
        <td class=\"data\">SHGoals</td>
        <td><input name=\"SHGoals\" type=\"text\" id=\"Goals\" size=\"6\" value=\"$SHGoals\"></td>
      </tr>
      <tr>
        <td class=\"data\">Assists</td>
        <td><input name=\"Assists\" type=\"text\" id=\"Assists\" size=\"6\" value=\"$Assists\"></td>
      </tr>  
      <tr>
        <td class=\"data\">PIM</td>
        <td><input name=\"PIM\" type=\"text\" id=\"PIM\" size=\"6\" value=\"$PIM\"></td>
      </tr>
      <tr>
        <td class=\"data\">Points</td>
        <td><input name=\"Points\" type=\"text\" id=\"Points\" size=\"6\" value=\"$Points\"></td>
      </tr>
      <tr>
        <td class=\"data\">GamesCup</td>
        <td><input name=\"GamesCup\" type=\"text\" id=\"GamesCup\" size=\"6\" value=\"$GamesCup\"></td>
      </tr>  <tr>
        <td class=\"data\">GoalsCup</td>
        <td><input name=\"GoalsCup\" type=\"text\" id=\"GoalsCup\" size=\"6\" value=\"$GoalsCup\"></td>
      </tr>  
      <tr>
        <td class=\"data\">PPGoalsCup</td>
        <td><input name=\"PPGoalsCup\" type=\"text\" id=\"GoalsCup\" size=\"6\" value=\"$PPGoalsCup\"></td>
      </tr><tr>
        <td class=\"data\">SHGoalsCup</td>
        <td><input name=\"SHGoalsCup\" type=\"text\" id=\"GoalsCup\" size=\"6\" value=\"$SHGoalsCup\"></td>
      </tr>
      <tr>  
        <td class=\"data\">AssistsCup</td>
        <td><input name=\"AssistsCup\" type=\"text\" id=\"AssistsCup\" size=\"6\" value=\"$AssistsCup\"></td>
      </tr>  
      <tr>  
        <td class=\"data\">PIMCup</td>
        <td><input name=\"PIMCup\" type=\"text\" id=\"PIMCup\" size=\"6\" value=\"$PIMCup\"></td>
      </tr>  
      <tr>  
        <td class=\"data\">PointsCup</td>
        <td><input name=\"PointsCup\" type=\"text\" id=\"PointsCup\" size=\"6\" value=\"$PointsCup\"></td>
      </tr>  "); 
    
  if ($stat==1) { } 
  else {   
  echo("  
  <tr><td class=\"data\">GamesPO</td>
        <td><input name=\"GamesPO\" type=\"text\" id=\"GamesPO\" size=\"6\" value=\"$GamesPO\"></td>
      </tr> <tr>  
        <td class=\"data\">GoalsPO</td>
        <td><input name=\"GoalsPO\" type=\"text\" id=\"GoalsPO\" size=\"6\" value=\"$GoalsPO\"></td>
      </tr>
  <tr>  
        <td class=\"data\">PPGoalsPO</td>
        <td><input name=\"PPGoalsPO\" type=\"text\" id=\"GoalsPO\" size=\"6\" value=\"$PPGoalsPO\"></td>
      </tr>  
  <tr>
  
  	
  
  
        <td class=\"data\">SHGoalsPO</td>
        <td><input name=\"SHGoalsPO\" type=\"text\" id=\"GoalsPO\" size=\"6\" value=\"$SHGoalsPO\"></td>
      </tr><tr>
  
  	
  
  
        <td class=\"data\">AssistsPO</td>
        <td><input name=\"AssistsPO\" type=\"text\" id=\"AssistsPO\" size=\"6\" value=\"$AssistsPO\"></td>
      </tr><tr>
  
  	
  
  
        <td class=\"data\">PIMPO</td>
        <td><input name=\"PIMPO\" type=\"text\" id=\"PIMPO\" size=\"6\" value=\"$PIMPO\"></td>
      </tr><tr>
  
  	
  
  
        <td class=\"data\">PointsPO</td>
        <td><input name=\"PointsPO\" type=\"text\" id=\"PointsPO\" size=\"6\" value=\"$PointsPO\"></td>
      </tr><tr>
  
  	
  
  
        <td class=\"data\">Nationality</td>
        <td><input name=\"Nationality\" type=\"text\" id=\"Nationality\" value=\"$Nationality\"></td>
      </tr>
  
  	
  
  <td class=\"data\"> </td>
        <td> </td>
      </tr>
      <tr>
        <td class=\"data\"> </td>
        <td><input type=\"submit\" name=\"Submit\" value=\"Edit\"></td>
      </tr>
    </table>
  </form>"); 
  }
  
  if ($stat!=0) {
  $query = "UPDATE `players` 
  SET `Nationality` = '$Nationality', 
  `GamesPO` = '$GamesPO' , 
  `AssistsPO` = '$AssistsPO' , 
  `GoalsPO` = '$GoalsPO' , 
  `PPGoalsPO` = '$PPGoalsPO' , 
  `SHGoalsPO` = '$SHGoalsPO' , 
  `PointsPO` = '$PointsPO' , 
  `PIMPO` = '$PIMPO' ,
  `PIM` = '$PIM' ,
  `PointsCup` = '$PointsCup' ,
  `PIMCup` = '$PIMCup' ,
  `AssistsCup` = '$AssistsCup' ,
  `GoalsCup` = '$GoalsCup' ,
  `PPGoalsCup` = '$PPGoalsCup' ,
  `SHGoalsCup` = '$SHGoalsCup' ,
  `GamesCup` = '$GamesCup' ,
  `Points` = '$Points',
  `Assists` = '$Assists' ,
  `Goals` = '$Goals' ,
  `PPGoals` = '$PPGoals' ,
  `SHGoals` = '$SHGoals' ,
  `TeamID` = '$TeamID' ,
  `Player` = '$Player' ,
  `Games` = '$Games' 
  WHERE `PlayerID` = '$PlayerID'";
  $result = mysql_query($query) die (mysql_error());
  $_SESSION['msg'] = "The player has been updated. No. of records updated, ", mysql_affected_rows();
  echo ("The player has been updated. No. of records updated, ", mysql_affected_rows(),"<br><br><a href=\"playerstats.php\"> Go back to the player List</a>");
  
  } 
  else {
  $query = "UPDATE `snl_players` 
  SET `PIM` = '$PIM' ,
  `GamesPO` = '$GamesPO' , 
  `AssistsPO` = '$AssistsPO' , 
  `GoalsPO` = '$GoalsPO' , 
  `PPGoalsPO` = '$PPGoalsPO' , 
  `SHGoalsPO` = '$SHGoalsPO' , 
  `PointsPO` = '$PointsPO' , 
  `PIMPO` = '$PIMPO' ,
  `PointsCup` = '$PointsCup' ,
  `PIMCup` = '$PIMCup' ,
  `AssistsCup` = '$AssistsCup' ,
  `GoalsCup` = '$GoalsCup' ,
  `PPGoalsCup` = '$PPGoalsCup' ,
  `SHGoalsCup` = '$SHGoalsCup' ,
  `GamesCup` = '$GamesCup' ,
  `Points` = '$Points',
  `Assists` = '$Assists' ,
  `Goals` = '$Goals' ,
  `PPGoals` = '$PPGoals' ,
  `SHGoals` = '$SHGoals' ,
  `TeamID` = '$TeamID' ,
  `Player` = '$Player' ,
  `Games` = '$Games' 
  WHERE `PlayerID` = '$PlayerID'";
  $result = mysql_query($query) or  die (mysql_error());
  $_SESSION['msg'] = "The player has been updated. No. of records updated, ", mysql_affected_rows();
  echo ("The player has been updated. No. of records updated, ", mysql_affected_rows(),"<br><br><a href=\"playerstats.php\"> Go back to the player List</a>");  
  }
} 
elseif (strcmp($act,'teamlist')==0) {
  $query112 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'";
  $result112 = mysql_query($query112) or  die (mysql_error());
  $rows2 = mysql_fetch_array($result112);
  $TeamName = $rows2['TeamName'];
  $Logo = $rows2['Logo'];
  
  if ($Logo!="") { echo("<img src=\"../Images/$Logo\" /><br><br>"); } else { }
  echo ("<strong>Edit $TeamName Players</strong><br><br>Click Player Names to edit details<br><br>");
  $query11 = "SELECT * FROM `players` WHERE `TeamID` = '$TeamID'";
  $result11 = mysql_query($query11) or  die (mysql_error());
  while ( $rows = mysql_fetch_array($result11) ) {
  $Player = $rows['Player'];
  $PlayerID = $rows['PlayerID'];
  $TeamID = $rows['TeamID'];
  
  
  echo ("<span class=\"style1\"><a href=\"playerstats.php?act=edit&PlayerID=$PlayerID&stat=1\">$Player</a><br>");
  } 
} 
else {
  echo ("Click Team Names to view players<br><br>");
  $query11 = "SELECT distinct TeamID FROM `players` ORDER BY `TeamID`";
  $result11 = mysql_query($query11) or    die (mysql_error());
  $TeamID_in = "";
  while ( $rows = mysql_fetch_array($result11) ) 
  {
    //$TeamID = $rows['TeamID'];
    $TeamID_in .= "'".$rows['TeamID']."',"; 
  }    
  (substr($TeamID_in,-1) == ",") ? substr($TeamID_in, 0, -1) : $TeamID_in;
  
  
  //  $query112 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'";
    $query112 = "SELECT * FROM `teams` WHERE `TeamID` IN ($TeamID_in)";
    $result112 = mysql_query($query112) or  die (mysql_error());
    $rows2 = mysql_fetch_array($result112);
    $TeamName = $rows2['TeamName'];
    
    echo ("<span class=\"style1\"><a href=\"playerstats.php?act=teamlist&TeamID=$TeamID&stat=1\">$TeamName</a><br>");
  } 
  echo ("<a name=\"snl\"></a><br><strong><a href=\"snlplayerstats.php\">SNL Teams</a></strong><br><br>");

}

?>

<p> </p>
<p> </p>
<p>
  <label>  </label>
</p>
<p>
  <label></label>
</p>
<p></p>
<p> </p>
<p> </p>
<p><a href=""></a></p>	</td>
</tr>
</table>
<div align="center"><img src="images/hr01.gif" width="556" height="11" alt="" border="0"></div>    </td>
</tr>
<tr valign="bottom" bgcolor="#D0E0ED">
  <td bgcolor="#E7BD1D"><img src="images/bot_left.gif" width="183" height="21" alt="" border="0"></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="780" height="64" background="images/fon_bot.gif">
<tr valign="top">
<td>
<table border="0" cellpadding="0" cellspacing="0" width="780" background="">
<tr>
<td width="300"><p class="menu02">Designed by Steven McLean</p></td>
<td>
<p class="menu02"><a href="">FifeFlyers.co.uk Admin Home</a></p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td valign="bottom" background="images/bg_right.gif"><img src="images/bg_right.gif" alt="" width="17" height="16" border="0"></td>
<td width="50%" background="images/bg.gif"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>
</tr>
</table>

</body>
</html>

There, fixed. Had extra closing curly brace, there were commas instead of concatenation operators, and an 'or' was missing in one of the 'or die' statements.

 

<?php include('../functions.php'); echo dbconnect(); include ('logincheck.php'); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Fife Flyers - Admin Area</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>

<body leftmargin=0 topmargin=0 marginheight="0" marginwidth="0" bgcolor="#ffffff">

<table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">
<tr valign="top">
<td width="50%" background="images/bg.gif"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>
<td valign="bottom" background="images/bg_left.gif"><img src="images/bg_left.gif" alt="" width="17" height="16" border="0"></td>
<td>
<table border="0" cellpadding="0" cellspacing="0" width="780" height="107">
<tr valign="bottom">
<td background="images/fon_top.gif"> </td>
<td width="673" background="images/fon_top.gif">
<table border="0" cellpadding="0" cellspacing="0" background="">
<tr valign="bottom">
<td>
<!-- but act -->
<table border="0" cellpadding="0" cellspacing="0">
<tr valign="bottom">
<td><img src="images/b_left_a.gif" width="9" height="37" alt="" border="0"></td>
<td background="images/b_fon_a.gif"><p class="menu01"><a href="index2.php">ADMIN  </a></p></td>
<td><img src="images/b_right_a.gif" width="9" height="37" alt="" border="0"></td>
</tr>
</table>
<!-- /but act -->	</td>
</tr>
</table>
</td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="780" height="107">
<tr valign="top">
  <td bgcolor="#E7BD1D"><table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr>
        <td bgcolor="#E7BD1D"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td> </td>
            </tr>
        </table></td>
      </tr>
    </table>
      <div align="center"></div>
    <div align="center"><img src="images/title01.gif" width="183" height="35" alt="" border="0"></div>
    <nobr class="right">
      <div style="padding-top: 10px; padding-left: 20px;"><span class="right"><?php echo("<form action=\"auth.php\" method=\"post\" name=\"login\" id=\"login\">
                                      Username: <input name=\"PHP_AUTH_USER\" type=\"text\" id=\"PHP_AUTH_USER\" value=\"username\"><br><br>
                    Password: <input name=\"PHP_AUTH_PW\" type=\"password\" id=\"PHP_AUTH_PW\" value=\"\"><br>
                    <input type=\"submit\" name=\"Submit\" value=\"Login\"> 
                            
                  </form>"); ?></span></div>
      </nobr>
      <div align="center">
      <p class="left"> </p>
    <br>
    <br>
  </td>
<td rowspan="2">
<div align="center"><img src="images/top01.gif" width="597" height="24" alt="" border="0"></div>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td> </td>
<td>
<p style="color: #1F269D; font-size: 20px; margin-left: 0px;"><b>Edit  Player Stats:</b></p>
<p style="color: #1F269D; font-size: 20px; margin-left: 0px;"><span style="color: #1F269D; font-size: 16px; margin-left: 0px;">Powerplay Goals & Shorthanded Goals are not to be added to points total - all goals scored should be added to goals column and these are added to total points. </span></p>
<?php 
session_start();

if( isset($_SESSION['msg']) )
  echo  $_SESSION['msg'];

error_reporting(E_ALL);
ini_set("display_errors", 1); 


if (isset($_REQUEST['act']))
{
  $act = $_REQUEST['act'];
}
if (isset($_REQUEST['stat']))
{
  $stat = $_REQUEST['stat'];
}


if ($stat==1) { 
  // normal players 
  $table = "players"; 
}
else  {
  // snl_players
  $table ="snl_players"; 
}

if (strcmp($act, 'edit')==0) 
{
  $query11 = "SELECT * FROM `$table` WHERE `PlayerID` = '$PlayerID'";
  $result11 = mysql_query($query11) or die (mysql_error());
  $rows = mysql_fetch_array($result11);
  $PlayerID = $rows['PlayerID'];
  $TeamID = $rows['TeamID'];
  $Team = $rows['Team'];
  $Player = $rows['Player'];
  $Games = $rows['Games'];
  $Goals = $rows['Goals'];
  $PPGoals = $rows['PPGoals'];
  $SHGoals = $rows['SHGoals'];
  $Assists = $rows['Assists'];
  $PIM = $rows['PIM'];
  $Points = $rows['Points'];
  $GamesCup = $rows['GamesCup'];
  $GoalsCup = $rows['GoalsCup'];
  $PPGoalsCup = $rows['PPGoalsCup'];
  $SHGoalsCup = $rows['SHGoalsCup'];
  $AssistsCup = $rows['AssistsCup'];
  $PIMCup = $rows['PIMCup'];
  $PointsCup = $rows['PointsCup'];
  /* $GamesNPL = $rows['GamesNPL'];
  $GoalsNPL = $rows['GoalsNPL'];
  $PPGoalsNPL = $rows['PPGoalsNPL'];
  $SHGoalsNPL = $rows['SHGoalsNPL'];
  $AssistsNPL = $rows['AssistsNPL'];
  $PIMNPL = $rows['PIMNPL'];
  $PointsNPL = $rows['PointsNPL']; */
  $GamesPO = $rows['GamesPO'];
  $GoalsPO = $rows['GoalsPO'];
  $PPGoalsPO = $rows['PPGoalsPO'];
  $SHGoalsPO = $rows['SHGoalsPO'];
  $AssistsPO = $rows['AssistsPO'];
  $PIMPO = $rows['PIMPO'];
  $PointsPO = $rows['PointsPO'];
  $Nationality = $rows['Nationality'];
  
  $query11 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'";
  $result11 = mysql_query($query11) or die (mysql_error());
  $rows = mysql_fetch_array($result11);
  $TeamName = $rows['TeamName'];
  
  
  echo ("<form name=\"form1\" method=\"post\" action=\"playerstats.php?act=editdo&PlayerID=$PlayerID&stat=$stat\">
    <table width=\"80%\" border=\"0\">
      <tr>
        <td width=\"30%\" class=\"data\">Player Name </td>
        <td width=\"70%\"><input name=\"Player\" type=\"text\" id=\"Player\" value=\"$Player\"></td>
      </tr>
      <tr>
        <td class=\"data\">Associated Team ID </td>
        <td class=\"data\">  <select name=\"TeamID\">");
  
  	
  
    
    $query11 = "SELECT * FROM `teams`";
    $result11 = mysql_query($query11) or die (mysql_error());
    while ( $rows = mysql_fetch_array($result11) ) 
    {
      $TeamName = $rows['TeamName'];    
      $TeamID2 = $rows['TeamID'];   
      if (strcmp($TeamID,$TeamID2)==0) { echo("    <option value=\"$TeamID2\" selected>$TeamName</option>"); } 
      else {  echo("    <option value=\"$TeamID2\">$TeamName</option>"); }
    }
      
    echo("</select></td>
      </tr>
      <tr>
        <td class=\"data\">Games</td>
        <td><input name=\"Games\" type=\"text\" id=\"Games\" size=\"6\" value=\"$Games\"></td>
      </tr>
      <tr>
        <td class=\"data\">Goals</td>
        <td><input name=\"Goals\" type=\"text\" id=\"Goals\" size=\"6\" value=\"$Goals\"></td>
      </tr>    <tr>
        <td class=\"data\">PPGoals</td>
        <td><input name=\"PPGoals\" type=\"text\" id=\"Goals\" size=\"6\" value=\"$PPGoals\"></td>
      </tr>    <tr>
        <td class=\"data\">SHGoals</td>
        <td><input name=\"SHGoals\" type=\"text\" id=\"Goals\" size=\"6\" value=\"$SHGoals\"></td>
      </tr>
      <tr>
        <td class=\"data\">Assists</td>
        <td><input name=\"Assists\" type=\"text\" id=\"Assists\" size=\"6\" value=\"$Assists\"></td>
      </tr>  
      <tr>
        <td class=\"data\">PIM</td>
        <td><input name=\"PIM\" type=\"text\" id=\"PIM\" size=\"6\" value=\"$PIM\"></td>
      </tr>
      <tr>
        <td class=\"data\">Points</td>
        <td><input name=\"Points\" type=\"text\" id=\"Points\" size=\"6\" value=\"$Points\"></td>
      </tr>
      <tr>
        <td class=\"data\">GamesCup</td>
        <td><input name=\"GamesCup\" type=\"text\" id=\"GamesCup\" size=\"6\" value=\"$GamesCup\"></td>
      </tr>  <tr>
        <td class=\"data\">GoalsCup</td>
        <td><input name=\"GoalsCup\" type=\"text\" id=\"GoalsCup\" size=\"6\" value=\"$GoalsCup\"></td>
      </tr>  
      <tr>
        <td class=\"data\">PPGoalsCup</td>
        <td><input name=\"PPGoalsCup\" type=\"text\" id=\"GoalsCup\" size=\"6\" value=\"$PPGoalsCup\"></td>
      </tr><tr>
        <td class=\"data\">SHGoalsCup</td>
        <td><input name=\"SHGoalsCup\" type=\"text\" id=\"GoalsCup\" size=\"6\" value=\"$SHGoalsCup\"></td>
      </tr>
      <tr>  
        <td class=\"data\">AssistsCup</td>
        <td><input name=\"AssistsCup\" type=\"text\" id=\"AssistsCup\" size=\"6\" value=\"$AssistsCup\"></td>
      </tr>  
      <tr>  
        <td class=\"data\">PIMCup</td>
        <td><input name=\"PIMCup\" type=\"text\" id=\"PIMCup\" size=\"6\" value=\"$PIMCup\"></td>
      </tr>  
      <tr>  
        <td class=\"data\">PointsCup</td>
        <td><input name=\"PointsCup\" type=\"text\" id=\"PointsCup\" size=\"6\" value=\"$PointsCup\"></td>
      </tr>  "); 
    
  if ($stat==1) { } 
  else {   
  echo("  
  <tr><td class=\"data\">GamesPO</td>
        <td><input name=\"GamesPO\" type=\"text\" id=\"GamesPO\" size=\"6\" value=\"$GamesPO\"></td>
      </tr> <tr>  
        <td class=\"data\">GoalsPO</td>
        <td><input name=\"GoalsPO\" type=\"text\" id=\"GoalsPO\" size=\"6\" value=\"$GoalsPO\"></td>
      </tr>
  <tr>  
        <td class=\"data\">PPGoalsPO</td>
        <td><input name=\"PPGoalsPO\" type=\"text\" id=\"GoalsPO\" size=\"6\" value=\"$PPGoalsPO\"></td>
      </tr>  
  <tr>
  
  	
  
  
        <td class=\"data\">SHGoalsPO</td>
        <td><input name=\"SHGoalsPO\" type=\"text\" id=\"GoalsPO\" size=\"6\" value=\"$SHGoalsPO\"></td>
      </tr><tr>
  
  	
  
  
        <td class=\"data\">AssistsPO</td>
        <td><input name=\"AssistsPO\" type=\"text\" id=\"AssistsPO\" size=\"6\" value=\"$AssistsPO\"></td>
      </tr><tr>
  
  	
  
  
        <td class=\"data\">PIMPO</td>
        <td><input name=\"PIMPO\" type=\"text\" id=\"PIMPO\" size=\"6\" value=\"$PIMPO\"></td>
      </tr><tr>
  
  	
  
  
        <td class=\"data\">PointsPO</td>
        <td><input name=\"PointsPO\" type=\"text\" id=\"PointsPO\" size=\"6\" value=\"$PointsPO\"></td>
      </tr><tr>
  
  	
  
  
        <td class=\"data\">Nationality</td>
        <td><input name=\"Nationality\" type=\"text\" id=\"Nationality\" value=\"$Nationality\"></td>
      </tr>
  
  	
  
  <td class=\"data\"> </td>
        <td> </td>
      </tr>
      <tr>
        <td class=\"data\"> </td>
        <td><input type=\"submit\" name=\"Submit\" value=\"Edit\"></td>
      </tr>
    </table>
  </form>"); 
  }
  
  if ($stat!=0) {
  $query = "UPDATE `players` 
  SET `Nationality` = '$Nationality', 
  `GamesPO` = '$GamesPO' , 
  `AssistsPO` = '$AssistsPO' , 
  `GoalsPO` = '$GoalsPO' , 
  `PPGoalsPO` = '$PPGoalsPO' , 
  `SHGoalsPO` = '$SHGoalsPO' , 
  `PointsPO` = '$PointsPO' , 
  `PIMPO` = '$PIMPO' ,
  `PIM` = '$PIM' ,
  `PointsCup` = '$PointsCup' ,
  `PIMCup` = '$PIMCup' ,
  `AssistsCup` = '$AssistsCup' ,
  `GoalsCup` = '$GoalsCup' ,
  `PPGoalsCup` = '$PPGoalsCup' ,
  `SHGoalsCup` = '$SHGoalsCup' ,
  `GamesCup` = '$GamesCup' ,
  `Points` = '$Points',
  `Assists` = '$Assists' ,
  `Goals` = '$Goals' ,
  `PPGoals` = '$PPGoals' ,
  `SHGoals` = '$SHGoals' ,
  `TeamID` = '$TeamID' ,
  `Player` = '$Player' ,
  `Games` = '$Games' 
  WHERE `PlayerID` = '$PlayerID'";
  $result = mysql_query($query) or die (mysql_error());
  $_SESSION['msg'] = "The player has been updated. No. of records updated, " . mysql_affected_rows();
  echo ("The player has been updated. No. of records updated, " . mysql_affected_rows() . "<br><br><a href=\"playerstats.php\"> Go back to the player List</a>");
  
  } 
  else {
  $query = "UPDATE `snl_players` 
  SET `PIM` = '$PIM' ,
  `GamesPO` = '$GamesPO' , 
  `AssistsPO` = '$AssistsPO' , 
  `GoalsPO` = '$GoalsPO' , 
  `PPGoalsPO` = '$PPGoalsPO' , 
  `SHGoalsPO` = '$SHGoalsPO' , 
  `PointsPO` = '$PointsPO' , 
  `PIMPO` = '$PIMPO' ,
  `PointsCup` = '$PointsCup' ,
  `PIMCup` = '$PIMCup' ,
  `AssistsCup` = '$AssistsCup' ,
  `GoalsCup` = '$GoalsCup' ,
  `PPGoalsCup` = '$PPGoalsCup' ,
  `SHGoalsCup` = '$SHGoalsCup' ,
  `GamesCup` = '$GamesCup' ,
  `Points` = '$Points',
  `Assists` = '$Assists' ,
  `Goals` = '$Goals' ,
  `PPGoals` = '$PPGoals' ,
  `SHGoals` = '$SHGoals' ,
  `TeamID` = '$TeamID' ,
  `Player` = '$Player' ,
  `Games` = '$Games' 
  WHERE `PlayerID` = '$PlayerID'";
  $result = mysql_query($query) or  die (mysql_error());
  $_SESSION['msg'] = "The player has been updated. No. of records updated, " . mysql_affected_rows();
  echo ("The player has been updated. No. of records updated, " . mysql_affected_rows() . "<br><br><a href=\"playerstats.php\"> Go back to the player List</a>");  
  }
} 
elseif (strcmp($act,'teamlist')==0) {
  $query112 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'";
  $result112 = mysql_query($query112) or  die (mysql_error());
  $rows2 = mysql_fetch_array($result112);
  $TeamName = $rows2['TeamName'];
  $Logo = $rows2['Logo'];
  
  if ($Logo!="") { echo("<img src=\"../Images/$Logo\" /><br><br>"); } else { }
  echo ("<strong>Edit $TeamName Players</strong><br><br>Click Player Names to edit details<br><br>");
  $query11 = "SELECT * FROM `players` WHERE `TeamID` = '$TeamID'";
  $result11 = mysql_query($query11) or  die (mysql_error());
  while ( $rows = mysql_fetch_array($result11) ) {
  $Player = $rows['Player'];
  $PlayerID = $rows['PlayerID'];
  $TeamID = $rows['TeamID'];
  
  
  echo ("<span class=\"style1\"><a href=\"playerstats.php?act=edit&PlayerID=$PlayerID&stat=1\">$Player</a><br>");
  } 
} 
else {
  echo ("Click Team Names to view players<br><br>");
  $query11 = "SELECT distinct TeamID FROM `players` ORDER BY `TeamID`";
  $result11 = mysql_query($query11) or    die (mysql_error());
  $TeamID_in = "";
  while ( $rows = mysql_fetch_array($result11) ) 
  {
    //$TeamID = $rows['TeamID'];
    $TeamID_in .= "'".$rows['TeamID']."',"; 
  }    
  (substr($TeamID_in,-1) == ",") ? substr($TeamID_in, 0, -1) : $TeamID_in;
  
  
  //  $query112 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'";
    $query112 = "SELECT * FROM `teams` WHERE `TeamID` IN ($TeamID_in)";
    $result112 = mysql_query($query112) or  die (mysql_error());
    $rows2 = mysql_fetch_array($result112);
    $TeamName = $rows2['TeamName'];
    
    echo ("<span class=\"style1\"><a href=\"playerstats.php?act=teamlist&TeamID=$TeamID&stat=1\">$TeamName</a><br>");
  } 
  echo ("<a name=\"snl\"></a><br><strong><a href=\"snlplayerstats.php\">SNL Teams</a></strong><br><br>");



?>

<p> </p>
<p> </p>
<p>
  <label>  </label>
</p>
<p>
  <label></label>
</p>
<p></p>
<p> </p>
<p> </p>
<p><a href=""></a></p>	</td>
</tr>
</table>
<div align="center"><img src="images/hr01.gif" width="556" height="11" alt="" border="0"></div>    </td>
</tr>
<tr valign="bottom" bgcolor="#D0E0ED">
  <td bgcolor="#E7BD1D"><img src="images/bot_left.gif" width="183" height="21" alt="" border="0"></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="780" height="64" background="images/fon_bot.gif">
<tr valign="top">
<td>
<table border="0" cellpadding="0" cellspacing="0" width="780" background="">
<tr>
<td width="300"><p class="menu02">Designed by Steven McLean</p></td>
<td>
<p class="menu02"><a href="">FifeFlyers.co.uk Admin Home</a></p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td valign="bottom" background="images/bg_right.gif"><img src="images/bg_right.gif" alt="" width="17" height="16" border="0"></td>
<td width="50%" background="images/bg.gif"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>
</tr>
</table>

</body>
</html>

Now getting:

 

Notice: Undefined variable: stat in C:\Domains\fifeflyers.co.uk\wwwroot\admin\snlplayerstats.php on line 92

 

Notice: Undefined variable: act in C:\Domains\fifeflyers.co.uk\wwwroot\admin\snlplayerstats.php on line 101

 

Notice: Undefined variable: act in C:\Domains\fifeflyers.co.uk\wwwroot\admin\snlplayerstats.php on line 350

Click Team Names to view players

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1

like everyone else i cleaned up the code, a few error i noticed,

However $stats only seems to be set by being passed to playerstats.php, is this correct ?

 

<?php include('../functions.php');
echo dbconnect();
include ('logincheck.php'); ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
  <head>
    <title>Fife Flyers - Admin Area</title>
    <link rel="stylesheet" type="text/css" href="style.css">
  </head>
  <body leftmargin=0 topmargin=0 marginheight="0" marginwidth="0" bgcolor="#ffffff">
    <table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%">
      <tr valign="top">
<td width="50%" background="images/bg.gif"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>
<td valign="bottom" background="images/bg_left.gif"><img src="images/bg_left.gif" alt="" width="17" height="16" border="0"></td>
<td>
  <table border="0" cellpadding="0" cellspacing="0" width="780" height="107">
    <tr valign="bottom">
      <td background="images/fon_top.gif"> </td>
      <td width="673" background="images/fon_top.gif">
	<table border="0" cellpadding="0" cellspacing="0" background="">
	  <tr valign="bottom">
	    <td>
	      <!-- but act -->
	      <table border="0" cellpadding="0" cellspacing="0">
		<tr valign="bottom">
		  <td><img src="images/b_left_a.gif" width="9" height="37" alt="" border="0"></td>
		  <td background="images/b_fon_a.gif"><p class="menu01"><a href="index2.php">ADMIN  </a></p></td>
		  <td><img src="images/b_right_a.gif" width="9" height="37" alt="" border="0"></td>
		</tr>
	      </table>
	      <!-- /but act -->
	    </td>
	  </tr>
	</table>
      </td>
    </tr>
  </table>
  <table border="0" cellpadding="0" cellspacing="0" width="780" height="107">
    <tr valign="top">
      <td bgcolor="#E7BD1D"><table border="0" cellpadding="0" cellspacing="0" width="100%">
	  <tr>
	    <td bgcolor="#E7BD1D"><table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr>
		  <td> </td>
		</tr>
	      </table></td>
	  </tr>
	</table>
	<div align="center"></div>
	<div align="center"><img src="images/title01.gif" width="183" height="35" alt="" border="0"></div>
    <nobr class="right">
      <div style="padding-top: 10px; padding-left: 20px;"><span class="right"><?php echo("<form action=\"auth.php\" method=\"post\" name=\"login\" id=\"login\">
                                      Username: <input name=\"PHP_AUTH_USER\" type=\"text\" id=\"PHP_AUTH_USER\" value=\"username\"><br><br>
                    Password: <input name=\"PHP_AUTH_PW\" type=\"password\" id=\"PHP_AUTH_PW\" value=\"\"><br>
                    <input type=\"submit\" name=\"Submit\" value=\"Login\">

                  </form>"); ?></span></div>
    </nobr>
      <p class="left"> </p>
      <br>
      <br>
      </td>
      <td rowspan="2">
	<div align="center"><img src="images/top01.gif" width="597" height="24" alt="" border="0"></div>
	<table border="0" cellpadding="0" cellspacing="0" width="100%">
	  <tr>
	    <td> </td>
	    <td>
	      <p style="color: #1F269D; font-size: 20px; margin-left: 0px;"><b>Edit  Player Stats:</b></p>
	      <p style="color: #1F269D; font-size: 20px; margin-left: 0px;"><span style="color: #1F269D; font-size: 16px; margin-left: 0px;">Powerplay Goals & Shorthanded Goals are not to be added to points total - all goals scored should be added to goals column and these are added to total points. </span></p>
	      <?php
	      session_start();

	      if( isset($_SESSION['msg']) ) echo  $_SESSION['msg'];

	      error_reporting(E_ALL);
	      ini_set("display_errors", 1);

	      if (isset($_REQUEST['act'])) {
		$act = $_REQUEST['act'];
	      }
	      if (isset($_REQUEST['stat'])) {
		$stat = $_REQUEST['stat'];
	      }

	      if ($stat==1) {
		// normal players
		$table = "players";
	      } else {
		// snl_players
		$table ="snl_players";
	      }

	      if (strcmp($act, 'edit')==0) {
		$query11 = "SELECT * FROM `$table` WHERE `PlayerID` = '$PlayerID'";
		$result11 = mysql_query($query11) or die (mysql_error());
		$rows = mysql_fetch_array($result11);
		$PlayerID = $rows['PlayerID'];
		$TeamID = $rows['TeamID'];
		$Team = $rows['Team'];
		$Player = $rows['Player'];
		$Games = $rows['Games'];
		$Goals = $rows['Goals'];
		$PPGoals = $rows['PPGoals'];
		$SHGoals = $rows['SHGoals'];
		$Assists = $rows['Assists'];
		$PIM = $rows['PIM'];
		$Points = $rows['Points'];
		$GamesCup = $rows['GamesCup'];
		$GoalsCup = $rows['GoalsCup'];
		$PPGoalsCup = $rows['PPGoalsCup'];
		$SHGoalsCup = $rows['SHGoalsCup'];
		$AssistsCup = $rows['AssistsCup'];
		$PIMCup = $rows['PIMCup'];
		$PointsCup = $rows['PointsCup'];
		/* $GamesNPL = $rows['GamesNPL'];
  $GoalsNPL = $rows['GoalsNPL'];
  $PPGoalsNPL = $rows['PPGoalsNPL'];
  $SHGoalsNPL = $rows['SHGoalsNPL'];
  $AssistsNPL = $rows['AssistsNPL'];
  $PIMNPL = $rows['PIMNPL'];
  $PointsNPL = $rows['PointsNPL']; */
		$GamesPO = $rows['GamesPO'];
		$GoalsPO = $rows['GoalsPO'];
		$PPGoalsPO = $rows['PPGoalsPO'];
		$SHGoalsPO = $rows['SHGoalsPO'];
		$AssistsPO = $rows['AssistsPO'];
		$PIMPO = $rows['PIMPO'];
		$PointsPO = $rows['PointsPO'];
		$Nationality = $rows['Nationality'];

		$query11 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'";
		$result11 = mysql_query($query11) or die (mysql_error());
		$rows = mysql_fetch_array($result11);
		$TeamName = $rows['TeamName'];


		echo ("<form name=\"form1\" method=\"post\" action=\"playerstats.php?act=edit&PlayerID=$PlayerID&stat=$stat\">
    <table width=\"80%\" border=\"0\">
      <tr>
        <td width=\"30%\" class=\"data\">Player Name </td>
        <td width=\"70%\"><input name=\"Player\" type=\"text\" id=\"Player\" value=\"$Player\"></td>
      </tr>
      <tr>
        <td class=\"data\">Associated Team ID </td>
        <td class=\"data\">  <select name=\"TeamID\">");




		$query11 = "SELECT * FROM `teams`";
		$result11 = mysql_query($query11) or die (mysql_error());
		while ( $rows = mysql_fetch_array($result11) ) {
		  $TeamName = $rows['TeamName'];
		  $TeamID2 = $rows['TeamID'];
		  if (strcmp($TeamID,$TeamID2)==0) {
		    echo("    <option value=\"$TeamID2\" selected>$TeamName</option>");
		  } else {
		    echo("    <option value=\"$TeamID2\">$TeamName</option>");
		  }
		}

		echo("</select></td>
      </tr>
      <tr>
        <td class=\"data\">Games</td>
        <td><input name=\"Games\" type=\"text\" id=\"Games\" size=\"6\" value=\"$Games\"></td>
      </tr>
      <tr>
        <td class=\"data\">Goals</td>
        <td><input name=\"Goals\" type=\"text\" id=\"Goals\" size=\"6\" value=\"$Goals\"></td>
      </tr>    <tr>
        <td class=\"data\">PPGoals</td>
        <td><input name=\"PPGoals\" type=\"text\" id=\"Goals\" size=\"6\" value=\"$PPGoals\"></td>
      </tr>    <tr>
        <td class=\"data\">SHGoals</td>
        <td><input name=\"SHGoals\" type=\"text\" id=\"Goals\" size=\"6\" value=\"$SHGoals\"></td>
      </tr>
      <tr>
        <td class=\"data\">Assists</td>
        <td><input name=\"Assists\" type=\"text\" id=\"Assists\" size=\"6\" value=\"$Assists\"></td>
      </tr>
      <tr>
        <td class=\"data\">PIM</td>
        <td><input name=\"PIM\" type=\"text\" id=\"PIM\" size=\"6\" value=\"$PIM\"></td>
      </tr>
      <tr>
        <td class=\"data\">Points</td>
        <td><input name=\"Points\" type=\"text\" id=\"Points\" size=\"6\" value=\"$Points\"></td>
      </tr>
      <tr>
        <td class=\"data\">GamesCup</td>
        <td><input name=\"GamesCup\" type=\"text\" id=\"GamesCup\" size=\"6\" value=\"$GamesCup\"></td>
      </tr>  <tr>
        <td class=\"data\">GoalsCup</td>
        <td><input name=\"GoalsCup\" type=\"text\" id=\"GoalsCup\" size=\"6\" value=\"$GoalsCup\"></td>
      </tr>
      <tr>
        <td class=\"data\">PPGoalsCup</td>
        <td><input name=\"PPGoalsCup\" type=\"text\" id=\"GoalsCup\" size=\"6\" value=\"$PPGoalsCup\"></td>
      </tr><tr>
        <td class=\"data\">SHGoalsCup</td>
        <td><input name=\"SHGoalsCup\" type=\"text\" id=\"GoalsCup\" size=\"6\" value=\"$SHGoalsCup\"></td>
      </tr>
      <tr>
        <td class=\"data\">AssistsCup</td>
        <td><input name=\"AssistsCup\" type=\"text\" id=\"AssistsCup\" size=\"6\" value=\"$AssistsCup\"></td>
      </tr>
      <tr>
        <td class=\"data\">PIMCup</td>
        <td><input name=\"PIMCup\" type=\"text\" id=\"PIMCup\" size=\"6\" value=\"$PIMCup\"></td>
      </tr>
      <tr>
        <td class=\"data\">PointsCup</td>
        <td><input name=\"PointsCup\" type=\"text\" id=\"PointsCup\" size=\"6\" value=\"$PointsCup\"></td>
      </tr>  ");

		if ($stat==1) {

		}else{
		  echo("
  <tr><td class=\"data\">GamesPO</td>
        <td><input name=\"GamesPO\" type=\"text\" id=\"GamesPO\" size=\"6\" value=\"$GamesPO\"></td>
      </tr> <tr>
        <td class=\"data\">GoalsPO</td>
        <td><input name=\"GoalsPO\" type=\"text\" id=\"GoalsPO\" size=\"6\" value=\"$GoalsPO\"></td>
      </tr>
  <tr>
        <td class=\"data\">PPGoalsPO</td>
        <td><input name=\"PPGoalsPO\" type=\"text\" id=\"GoalsPO\" size=\"6\" value=\"$PPGoalsPO\"></td>
      </tr>
  <tr>




        <td class=\"data\">SHGoalsPO</td>
        <td><input name=\"SHGoalsPO\" type=\"text\" id=\"GoalsPO\" size=\"6\" value=\"$SHGoalsPO\"></td>
      </tr><tr>




        <td class=\"data\">AssistsPO</td>
        <td><input name=\"AssistsPO\" type=\"text\" id=\"AssistsPO\" size=\"6\" value=\"$AssistsPO\"></td>
      </tr><tr>




        <td class=\"data\">PIMPO</td>
        <td><input name=\"PIMPO\" type=\"text\" id=\"PIMPO\" size=\"6\" value=\"$PIMPO\"></td>
      </tr><tr>




        <td class=\"data\">PointsPO</td>
        <td><input name=\"PointsPO\" type=\"text\" id=\"PointsPO\" size=\"6\" value=\"$PointsPO\"></td>
      </tr><tr>




        <td class=\"data\">Nationality</td>
        <td><input name=\"Nationality\" type=\"text\" id=\"Nationality\" value=\"$Nationality\"></td>
      </tr>



  <td class=\"data\"> </td>
        <td> </td>
      </tr>
      <tr>
        <td class=\"data\"> </td>
        <td><input type=\"submit\" name=\"Submit\" value=\"Edit\"></td>
      </tr>
    </table>
  </form>");
		}

		if ($stat!=0) {
		  $query = "UPDATE `players`
  SET `Nationality` = '{$_POST['Nationality']}',
  `GamesPO` = '{$_POST['GamesPO']}',
  `AssistsPO` = '{$_POST['AssistsPO']}',
  `GoalsPO` = '{$_POST['GoalsPO']}',
  `PPGoalsPO` = '{$_POST['PPGoalsPO']}',
  `SHGoalsPO` = '{$_POST['SHGoalsPO']}',
  `PointsPO` = '{$_POST['PointsPO']}',
  `PIMPO` = '{$_POST['PIMPO']}' ,
  `PIM` = '{$_POST['PIM']}' ,
  `PointsCup` = '{$_POST['PointsCup']}' ,
  `PIMCup` = '{$_POST['PIMCup']}' ,
  `AssistsCup` = '{$_POST['AssistsCup']}' ,
  `GoalsCup` = '{$_POST['GoalsCup']}' ,
  `PPGoalsCup` = '{$_POST['PPGoalsCup']}' ,
  `SHGoalsCup` = '{$_POST['SHGoalsCup']}' ,
  `GamesCup` = '{$_POST['GamesCup']}' ,
  `Points` = '{$_POST['Points']}' ,
  `Assists` = '{$_POST['Assists']}' ,
  `Goals` = '{$_POST['Goals']}' ,
  `PPGoals` = '{$_POST['PPGoals']}' ,
  `SHGoals` = '{$_POST['SHGoals']}' ,
  `TeamID` = '{$_POST['TeamID']}' ,
  `Player` = '{$_POST['Player']}' ,
  `Games` = '{$_POST['Games' ]}'
  WHERE `PlayerID` = '{$_GET['PlayerID']}'";
		  $result = mysql_query($query) or die (mysql_error());
		  $_SESSION['msg'] = "The player has been updated. No. of records updated, ". mysql_affected_rows();
		  echo ("The player has been updated. No. of records updated, ".mysql_affected_rows()."<br><br><a href=\"playerstats.php\"> Go back to the player List</a>");

		} else {
		  $query = "UPDATE `snl_players`
SET `Nationality` = '{$_POST['Nationality']}',
  `GamesPO` = '{$_POST['GamesPO']}',
  `AssistsPO` = '{$_POST['AssistsPO']}',
  `GoalsPO` = '{$_POST['GoalsPO']}',
  `PPGoalsPO` = '{$_POST['PPGoalsPO']}',
  `SHGoalsPO` = '{$_POST['SHGoalsPO']}',
  `PointsPO` = '{$_POST['PointsPO']}',
  `PIMPO` = '{$_POST['PIMPO']}' ,
  `PIM` = '{$_POST['PIM']}' ,
  `PointsCup` = '{$_POST['PointsCup']}' ,
  `PIMCup` = '{$_POST['PIMCup']}' ,
  `AssistsCup` = '{$_POST['AssistsCup']}' ,
  `GoalsCup` = '{$_POST['GoalsCup']}' ,
  `PPGoalsCup` = '{$_POST['PPGoalsCup']}' ,
  `SHGoalsCup` = '{$_POST['SHGoalsCup']}' ,
  `GamesCup` = '{$_POST['GamesCup']}' ,
  `Points` = '{$_POST['Points']}' ,
  `Assists` = '{$_POST['Assists']}' ,
  `Goals` = '{$_POST['Goals']}' ,
  `PPGoals` = '{$_POST['PPGoals']}' ,
  `SHGoals` = '{$_POST['SHGoals']}' ,
  `TeamID` = '{$_POST['TeamID']}' ,
  `Player` = '{$_POST['Player']}' ,
  `Games` = '{$_POST['Games' ]}'
  WHERE `PlayerID` = '{$_GET['PlayerID']}'";
		  $result = mysql_query($query) or  die (mysql_error());
		  $_SESSION['msg'] = "The player has been updated. No. of records updated, ". mysql_affected_rows();
		  echo ("The player has been updated. No. of records updated, ". mysql_affected_rows()."<br><br><a href=\"playerstats.php\"> Go back to the player List</a>");
		}
	      } elseif (strcmp($act,'teamlist')==0) {
		$query112 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'";
		$result112 = mysql_query($query112) or  die (mysql_error());
		$rows2 = mysql_fetch_array($result112);
		$TeamName = $rows2['TeamName'];
		$Logo = $rows2['Logo'];

		if ($Logo!="") {
		  echo("<img src=\"../Images/$Logo\" /><br><br>");
		} else {

		}
		echo ("<strong>Edit $TeamName Players</strong><br><br>Click Player Names to edit details<br><br>");
		$query11 = "SELECT * FROM `players` WHERE `TeamID` = '$TeamID'";
		$result11 = mysql_query($query11) or  die (mysql_error());
		while ( $rows = mysql_fetch_array($result11) ) {
		  $Player = $rows['Player'];
		  $PlayerID = $rows['PlayerID'];
		  $TeamID = $rows['TeamID'];


		  echo ("<span class=\"style1\"><a href=\"playerstats.php?act=edit&PlayerID=$PlayerID&stat=1\">$Player</a><br>");
		}
	      } else {
		echo ("Click Team Names to view players<br><br>");
		$query11 = "SELECT distinct TeamID FROM `players` ORDER BY `TeamID`";
		$result11 = mysql_query($query11) or    die (mysql_error());
		$TeamID_in = "";
		while ( $rows = mysql_fetch_array($result11) ) {
		  //$TeamID = $rows['TeamID'];
		  $TeamID_in .= "'".$rows['TeamID']."',";
		}
		(substr($TeamID_in,-1) == ",") ? substr($TeamID_in, 0, -1) : $TeamID_in;


		//  $query112 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'";
		$query112 = "SELECT * FROM `teams` WHERE `TeamID` IN ($TeamID_in)";
		$result112 = mysql_query($query112) or  die (mysql_error());
		$rows2 = mysql_fetch_array($result112);
		$TeamName = $rows2['TeamName'];
		echo ("<span class=\"style1\"><a href=\"playerstats.php?act=teamlist&TeamID=$TeamID&stat=1\">$TeamName</a><br>");
	      }
	      echo ("<a name=\"snl\"></a><br><strong><a href=\"snlplayerstats.php\">SNL Teams</a></strong><br><br>");
?>

	      <p> </p>
	      <p> </p>
	      <p>
		<label>  </label>
	      </p>
	      <p>
		<label></label>
	      </p>
	      <p></p>
	      <p> </p>
	      <p> </p>
	      <p><a href=""></a></p>   </td>
	  </tr>
	</table>
	<div align="center"><img src="images/hr01.gif" width="556" height="11" alt="" border="0"></div>    </td>
      </tr>
      <tr valign="bottom" bgcolor="#D0E0ED">
	<td bgcolor="#E7BD1D"><img src="images/bot_left.gif" width="183" height="21" alt="" border="0"></td>
      </tr>
  </table>
  <table border="0" cellpadding="0" cellspacing="0" width="780" height="64" background="images/fon_bot.gif">
    <tr valign="top">
      <td>
	<table border="0" cellpadding="0" cellspacing="0" width="780" background="">
	  <tr>
	    <td width="300"><p class="menu02">Designed by Steven McLean</p></td>
	    <td>
	      <p class="menu02"><a href="">FifeFlyers.co.uk Admin Home</a></p>
	    </td>
	  </tr>
	</table>
      </td>
    </tr>
  </table>
</td>
<td valign="bottom" background="images/bg_right.gif"><img src="images/bg_right.gif" alt="" width="17" height="16" border="0"></td>
<td width="50%" background="images/bg.gif"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>
      </tr>
    </table>

  </body>
</html>

 

EDIT: updated the code.. i noticed your not using $_POST to update your fields.. so i updated that

Not sure what you mean.

 

Other than removing a competition and replacing it with another (I had to remove a competition that is no longer taking place from collecting the stats and changing an existing one to take it's place) nothing else has changed since it last worked.

 

I would really appreciate some more help, I need to try and get this fixed for next week.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.