I have just discovered a fairly large flaw in my code and I could use some idea's on the best way to fix it.
My site pulls up league info from tables, however one type of league is a different format to the others and uses 'Times_1st', 'Times_2nd' and 'Times_3rd' instead of Win, Lose or Draw. So when a user tries to view a table like this, they get the information that is shared by all league types (games played, points, etc.) but the data that is unique to this type of league is not shown.
Users (for now) view the tables by typing in which league they would like to view. This is then used as a $_POST variable and queried to select the info and put into a table (as you can see below).
So, is there a decent fix to this or am I going to have to add direct links the each league sooner than planned?
Any help is greatly appreciated.
James
//Declare variables.
$leagueName = mysql_real_escape_string($_POST["leagueName"]);
//Echo league name.
echo "<h2>$leagueName</h2><br />";
//Get league info.
$result = mysql_query("SELECT * FROM $leagueName ORDER BY Points DESC");
echo "<table border='0' bgcolor='#DBB540'>
<tr>
<th><h1>Player |</h1></th>
<th><h1>Games Played |</h1></th>
<th><h1>Wins |</h1></th>
<th><h1>Losses |</h1></th>
<th><h1>Draws |</h1></th>
<th><h1>Points </h1></th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td><h4>" . $row['PlayerName'] . "</h4></td>";
echo "<td><h4>" . $row['GamesPlayed'] . "</h4></td>";
echo "<td><h4>" . $row['Wins'] . "</h4></td>";
echo "<td><h4>" . $row['Losses'] . "</h4></td>";
echo "<td><h4>" . $row['Draws'] . "</h4></td>";
echo "<td><h4>" . $row['Points'] . "</h4></td>";
echo "</tr>";
}
echo "</table>";