twilitegxa Posted January 30, 2010 Share Posted January 30, 2010 I have this code for a select option list: <?php $get_map = "select * from monsters1"; $get_map_res = mysql_query($get_map, $conn) or die(mysql_error()); echo "<select name=\"maps\" onchange=\"showMap(this.value)\"> <option selected=\"selected\">None Selected</option>"; while ($list_maps = mysql_fetch_array($get_map_res)) { $map_id = $list_maps['id']; $map = $list_maps['map']; echo "<option value=\"$map_id\">$map</option>"; } echo "</select>"; ?> But I have several records with the same value. How can I make it to where each value only displays once in my list? Quote Link to comment Share on other sites More sharing options...
mmarif4u Posted January 30, 2010 Share Posted January 30, 2010 You can use group by for that field. $get_map = "select * from monsters1 group by map"; You can change map to the field, which you want to show once. Quote Link to comment Share on other sites More sharing options...
twilitegxa Posted January 30, 2010 Author Share Posted January 30, 2010 Oh, thank you so much! I knew it was something simple, I just couldn't remember what it was. Thanks so much! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.