I have edited the question as what I said before was two pieces of code together.
I have the following code:
$f = "SELECT * FROM ".TBL_FIXTURES." WHERE compname = '$_POST[league]' AND home_user = '$_SESSION[username]' ORDER BY away_user";
$fixtures = mysql_query($f);
?>
<?
while( $row = mysql_fetch_assoc($fixtures))
{
extract($row);
$info = explode("_",$row[compname]);
?>
<select name="hu" class="combo">
<option value="<? echo $home_user ?>"><? echo $home_user?></option>
</select>
<select name="au" class="combo">
<?php
while( $row = mysql_fetch_assoc($fixtures))
{
$u=$row['away_user'];
echo "<option value=\"$u\">$u</option>";
}
?>
</select>
<?
}
?>
As you can see, there are two while loops. But the first value from the dropdown list for away_user is missing. If i remove the first loop, it appears but the drop down for home_user disappears. How can i get around this?
THanks
The problem is that in your second loop you call mysql_fetch_assoc($fixtures) so you move on to the second record before using the away_user field from the first record. Two options I can think of are:
Create the first option before the loop
Change the loop to a do while loop