hurricaneweb Posted August 18, 2007 Share Posted August 18, 2007 I have a <select> list of dates within a form that pulls dates from a SQL table. It works fine except that I would like it to not show the same date multiple times. In other words, I'd like it to display the next date when that field changes. Here's what it displays right now: Here is what I have for the code for that select list: <select name="date_gms" id="date_gms"> <?php do { ?> <option value="<?php echo $row_rsSchedule['date_sch']?>"<?php if (!(strcmp($row_rsSchedule['date_sch'], $row_rsGames['date_gms']))) {echo "SELECTED";} ?>><?php echo $row_rsSchedule['date_sch']?></option> <?php } while ($row_rsSchedule = mysql_fetch_assoc($rsSchedule)); $rows = mysql_num_rows($rsSchedule); if($rows > 0) { mysql_data_seek($rsSchedule, 0); $row_rsSchedule = mysql_fetch_assoc($rsSchedule); } ?> </select> Thanks so much in advance. Cary Quote Link to comment https://forums.phpfreaks.com/topic/65636-solved-form-drop-down-list-help/ Share on other sites More sharing options...
ToonMariner Posted August 19, 2007 Share Posted August 19, 2007 in yoru query use teh UNIQUE term to make sure you don't select multiple values for that field... Quote Link to comment https://forums.phpfreaks.com/topic/65636-solved-form-drop-down-list-help/#findComment-327836 Share on other sites More sharing options...
magic2goodil Posted August 19, 2007 Share Posted August 19, 2007 DISTINCT would work as well Quote Link to comment https://forums.phpfreaks.com/topic/65636-solved-form-drop-down-list-help/#findComment-327845 Share on other sites More sharing options...
hurricaneweb Posted August 19, 2007 Author Share Posted August 19, 2007 Thanks very much to both of you! Using DISTINCT in the rs query was way too simple for me to even think about to begin with. It worked like a charm. Much appreciated! Cary Quote Link to comment https://forums.phpfreaks.com/topic/65636-solved-form-drop-down-list-help/#findComment-327891 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.