Hi All,
I have a function:
// Start function to pull out data for all
function db_result_to_array($result)
{
$res_array = array();
for ($count=0; $row = mysql_fetch_array($result); $count++)
$res_array[$count] = $row;
return $res_array;
}
// Get the player names out of database reports
function get_player_names() {
$query='SELECT player_id, player_name FROM players';
$result=mysql_query($query);
if(FALSE==$result)
return FALSE;
if((0 || FALSE)==mysql_num_rows($result)) {
return false;
} else {
$result=db_result_to_array($result);
return $result;
}
}

Which grabs two values player_id andplayer_name from a players table and plonks them in a dropdown menu here:
<select class="input" name="player_one" size="1" style="width: 145" tabindex="1">
<option value="" selected>player_one</option>
<?php
$type_array=get_player_names();
foreach ($type_array as $players)
{
print("<option value=\"".$players['player_id']."\">".$players['player_name']."</option>\n");
}
?>
</select>
Which are then saved into an appearances table upon submit:

So say have a web page:
www.kksakskssasa.com/team.php?appearances_id=x
Which holds the values of the players from the dropdown in the table called appearances
And wanted to GET the data for a player ie ‘player_id=x’ from a database to appear in the dropdown automatically when I wanted to edit a record in the appearances table.
How can I change this code so that when I look at the dropdown it shows the player name of ‘player_id=x’ saved in the database table appearances in the dropdown?
Understand? Or am I not being clear?
Thanks
Chris