0

I need help with this. I am sure its an easy thing.. but I am stumped for some dumb reason....

all this works just fine.. but what I want to echo out is fname and lname of each person once they are selected as well as the next section of code I have... I guess what I am asking in short is how to set or create variables based on the array being pulled?

$selected_player = addslashes($_POST);
$query="SELECT * FROM player ORDER BY lname ";
$result=mysql_query($query);

echo "<option selected>-- Select Player --</option>";
while ($row=mysql_fetch_array($result)) {
if ($row > 0) {
echo '<option value="'.$row.'">'.$row.' '.$row.'</option>';
//$fname = $row;
}

else {
print("<option value=\"\">No Players On Roster</option>");
}
}

//mysql_close;
?>

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by cwarn23
0

Try replacing your code with this:

$query="SELECT * FROM player ORDER BY lname ";
$result=mysql_query($query); 

echo "<option selected>-- Select Player --</option>";
if (mysql_num_rows($result)>0) {
print("<option value=\"\">No Players On Roster</option>");
} else {
while ($row=mysql_fetch_assoc($result)) { 
echo '<option value="'.$row['id'].'">'.$row['fname'].' '.$row['lname'].'</option>';
}
}
//mysql_close;
?>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.