I have this code that gives me a selection box of a list of players from a certain team. The team is selected from a pull down box on an earlier page.
The problem is that it cannot find the number of a player. Everyway I try to do it it cannot find it. However if I move "number AS number" to the beginning just after the "select" call it find the number and stores it as the firstname.
What is wrong here?
My tables are set up as:
number team firstname lastname gp goals
--------- --------- ------------- ------------ --- -------
16 thunder dawson irvine 50 32
there are more fields but I don't need those selected yet. Just the name and number so I can select the players without confusion, incase there are two with the same name.
The problem is that it cannot find the number of a player. Everyway I try to do it it cannot find it. However if I move "number AS number" to the beginning just after the "select" call it find the number and stores it as the firstname.
What is wrong here?
PHP Code:
<form name="findplayer" method="post" action="teams.php?ax=editteam">
<div align="center">
<?php
$query = mysql_query("select firstname AS firstname, lastname AS lastname, number AS number from hockeystats_players WHERE team='$team' ORDER BY lastname");
echo "<select name=playersname>";
if (!isset($firstname)) { echo "<option value=null selected>Choose a Player</option>n";}
while(list($firstname,$lastname) = mysql_fetch_row($query))
{
echo "<option value=$number";
if ($firstname == $firstname) { echo ""; }
echo ">$lastname, $firstname</option>";
}
echo "</select>";?>
<br>
<input type="submit" name="Submit" value="Submit">
</div>
</form>
number team firstname lastname gp goals
--------- --------- ------------- ------------ --- -------
16 thunder dawson irvine 50 32
there are more fields but I don't need those selected yet. Just the name and number so I can select the players without confusion, incase there are two with the same name.
Comment