PHP: <?php global $no_of_players;if ($act==Goals) { $sort=1; $display=$act; } elseif ($act==Assists) { $sort=1; $display=$act; } elseif ($act==Games) { $sort=1; $display="Appearances"; } elseif ($act==PIM) { $sort=1; $display=$act; } elseif ($act==Points) { $sort=1; $display=$act;} elseif ($act==GoalsAgainst) { $sort=1; $display="Goals Conceded"; $g=1;} elseif ($act==Shots) { $sort=1; $display="Shots Against"; $g=1; } elseif ($act==SavePercentage) { $sort=1; $display="Save Percentage"; $sp=1; $g=1;} elseif ($act==ShutOuts) { $sort=1; $display=$act; } else { $sort=""; }if ($sort !=0) {if ($g !=0) {// Goalieecho ("$display </p><table width=\"350\" border=\"0\" align=\"center\"><tr><td width=\"175\" bgcolor=\"#E7BD1D\"><span class=\"style13\"><strong>Goalie</strong></span></td><td width=\"100\" bgcolor=\"#E7BD1D\"><div align=\"center\" class=\"style13\"><strong>Team</strong></div></td><td width=\"75\"bgcolor=\"#E7BD1D\"><div align=\"center\" class=\"style13\"><strong>$act</strong></div></td></tr>"); $count = 1; if ($sp!=0) { $query = "SELECT *, IF( Shots = 0, 0, Shots-GoalsAgainst / Shots ) as save_percentage FROM `snl_goalies` ORDER BY $act desc LIMIT $no_of_players"; $result = mysql_query($query) or die ('Unable to show players'); while ( $rows = mysql_fetch_array($result) ) { $Goalie = $rows['Goalie']; $Shots = $rows['Shots']; $GoalsAgainst = $rows['GoalsAgainst']; $ShutOuts = $rows['ShutOuts']; $TeamID = $rows['TeamID']; if ($Shots || $GoalsAgainst == "") { $Stat1 = $Shots-$GoalsAgainst; $Stat = $Stat1 / $Shots; $Stat = number_format($Stat, 2); } else { $Stat = "0"; } $query1 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'"; $result1 = mysql_query($query1) or die ('Unable to show players'); $rows1 = mysql_fetch_array($result1); $TeamName = $rows1['ShortName']; if($count%2){ echo ("<tr><td bgcolor=\"#FFFFFF\"><span class=\"style18\">$Goalie</span></td> <td bgcolor=\"#FFFFFF\"><div align=\"center\" class=\"style18\"><a href=\"TeamStats.php?TeamID=$TeamID\">$TeamName</a></div></td><td bgcolor=\"#FFFFFF\"><div align=\"center\" class=\"style18\">$Stat</div></td></tr>"); $count++; } else { echo ("<tr><td bgcolor=\"#EEEEEE\"><span class=\"style18\">$Goalie</span></td> <td bgcolor=\"#EEEEEE\"><div align=\"center\" class=\"style18\"><a href=\"TeamStats.php?TeamID=$TeamID\">$TeamName</a></div></td><td bgcolor=\"#EEEEEE\"><div align=\"center\" class=\"style18\">$Stat</div></td> </tr>"); $count++; } } echo ("</table></p><p class=\"style18\"><a href=\"snlplayers.php\">< Back to top players</a>"); } else { $query = "SELECT * FROM `snl_goalies` ORDER BY $act desc LIMIT $no_of_players"; $result = mysql_query($query) or die ('Unable to show players'); while ( $rows = mysql_fetch_array($result) ) { $Goalie = $rows['Goalie']; $Stat = $rows["$act"]; $TeamID = $rows['TeamID']; $query1 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'"; $result1 = mysql_query($query1) or die ('Unable to show players'); $rows1 = mysql_fetch_array($result1); $TeamName = $rows1['ShortName']; if($count%2){ echo ("<tr><td bgcolor=\"#FFFFFF\"><span class=\"style18\">$Goalie</span></td> <td bgcolor=\"#FFFFFF\"><div align=\"center\" class=\"style18\"><a href=\"TeamStats.php?TeamID=$TeamID\">$TeamName</a></div></td><td bgcolor=\"#FFFFFF\"><div align=\"center\" class=\"style18\">$Stat</div></td></tr>"); $count++; } else { echo ("<tr><td bgcolor=\"#EEEEEE\"><span class=\"style18\">$Goalie</span></td> <td bgcolor=\"#EEEEEE\"><div align=\"center\" class=\"style18\"><a href=\"TeamStats.php?TeamID=$TeamID\">$TeamName</a></div></td><td bgcolor=\"#EEEEEE\"><div align=\"center\" class=\"style18\">$Stat</div></td> </tr>"); $count++; } } echo ("</table></p><p class=\"style18\"><a href=\"snlplayers.php\">< Back to top players</a>"); }} else { // regular player echo ("$act </p> <table width=\"350\" border=\"0\" align=\"center\"> <tr> <td width=\"175\" bgcolor=\"#E7BD1D\"><span class=\"style18\"><strong>Player</strong></span></td> <td width=\"100\" bgcolor=\"#E7BD1D\"><div align=\"center\" class=\"style18\"><strong>Team</strong></div></td> <td width=\"75\"bgcolor=\"#E7BD1D\"><div align=\"center\" class=\"style18\"><strong>$act</strong></div></td></tr>"); $count = 1; $query = "SELECT * FROM `snl_players` ORDER BY $act desc LIMIT $no_of_players"; $result = mysql_query($query) or die ('Unable to show players'); while ( $rows = mysql_fetch_array($result) ) { $Player = $rows['Player']; $Stat = $rows["$act"]; $TeamID = $rows['TeamID']; $query1 = "SELECT * FROM `teams` WHERE `TeamID` = '$TeamID'"; $result1 = mysql_query($query1) or die ('Unable to show players'); $rows1 = mysql_fetch_array($result1); $TeamName = $rows1['ShortName']; if($count%2){ echo ("<tr><td bgcolor=\"#FFFFFF\"><span class=\"style18\">$Player</span></td> <td bgcolor=\"#FFFFFF\"><div align=\"center\" class=\"style18\"><a href=\"TeamStats.php?TeamID=$TeamID\">$TeamName</a></div></td><td bgcolor=\"#FFFFFF\"><div align=\"center\" class=\"style18\">$Stat</div></td></tr>"); $count++; } else { echo ("<tr><td bgcolor=\"#EEEEEE\"><span class=\"style18\">$Player</span></td> <td bgcolor=\"#EEEEEE\"><div align=\"center\" class=\"style18\"><a href=\"TeamStats.php?TeamID=$TeamID\">$TeamName</a></div></td><td bgcolor=\"#EEEEEE\"><div align=\"center\" class=\"style18\">$Stat</div></td> </tr>"); $count++; } } echo ("</table></p><p class=\"style18\"><a href=\"snlplayers.php\"> < Back to top players</a>"); } } else { // show available sorts include ('snl_players_list.php'); } ?> I am trying to get the following page http://www.fifeflyers.co.uk/snlplayers.php to display the 'Shut Outs' info but when you click on it, I get the message Unable to show players I was wondering if anyone could see what's wrong with the code? I cant see it, been looking at it too long now.
Best way to start would be to change all of the "or die" messages Change them to "Unable to show players1", "Unable to show players2" etc. That way you'll know which query is failing If you send me a ticket with the login details, I'll have a look at the database etc. for you
Changing the error messages is a good place to start. If you still havent sorted it let me know. I think thats my code?
Ok, from the 1st "Unable to show player" I have labelled them 1 - 6, and it is the 5th one that gives me the error - unable to show players5. It is Nick, I have finally got round to trying to add the shut outs to the list. lol
I have checked and double checked that ShutOuts is in my database, even double checked my spelling, it is definitely there - does the order of the D/B matter?
Is this query 5? PHP: $query = "SELECT * FROM `snl_players` ORDER BY $act desc LIMIT $no_of_players"; $result = mysql_query($query) or die ('Unable to show players');
Try replacing the top line with this: PHP: if ($act==Goals) { $sort=1; $display=$act; } elseif ($act==Assists) { $sort=1; $display=$act; } elseif ($act==Games) { $sort=1; $display="Appearances"; } elseif ($act==PIM) { $sort=1; $display=$act; } elseif ($act==Points) { $sort=1; $display=$act;} elseif ($act==GoalsAgainst) { $sort=1; $display="Goals Conceded"; $g=1;} elseif ($act==Shots) { $sort=1; $display="Shots Against"; $g=1; } elseif ($act==SavePercentage) { $sort=1; $display="Save Percentage"; $sp=1; $g=1;} elseif ($act==ShutOuts) { $sort=1; $display=$act; $g=1;} else { $sort=""; } Which gives this: http://www.fifeflyers.co.uk/snlplayers.php?act=ShutOuts&g=1 Which seems to work
It looks like that line has been fixed, probably Nick having a look at the same time Glad it is working
so for my other pages, http://www.fifeflyers.co.uk/snlplayers.php if you look at the links on the right, will it be a case of adding the same code to each section of those pages?