I am attempting to populate a drop down field with info from a database. All works perfectly until I add distinct in. The data is coming from a database that has 333 records, with 2 distinct years. When I remove the DISTINCT paramer I get all records. When I include the DISTINCT parameters I get one record. Havent been able to figure this on out yet. Any help would be appreciated, as I am sure that it is something simple that I have overlooked.
Here is the code in question.
<SELECT ID="Forms Combo Box1" NAME="cmbYear"> <?php
mysql_connect("*********", *********, *********)
or die("Could not connect to database");
mysql_select_db("nfl")
or die("Could not select database");
if(!isset($query) || empty($query))
{$query = "SELECT DISTINCT game_season FROM game_info ORDER BY game_season";}
$result = mysql_query($query) or die(mysql_error());
while($year=mysql_fetch_row($result)){
print "<option value='$year[0]'>$year[0]<br>";}
?>
</SELECT>