SkullzY88 Posted March 7, 2008 Share Posted March 7, 2008 [the fallowing is just an example] okay this is the problem i have an sql set up with id - name - date and in them are the fallowing 1 - bob0 - 01.02.08 2 - bob1 - 01.02.08 3 - bob2 - 01.02.08 4 - bob3 - 02.03.08 5 - bob4 - 01.02.08 6 - bob5 - 04.02.08 i want to display this information as a search but i want it displayed by date now the dates will be displayed by the "<select></select>" but if i do <?PHP <select name="date"> $sql = mysql_query("SELECT * FROM db"); while($get = mysql_fetch_array($sql)) { echo '<option value="'.$get['date'].'">'.$get['date'].'</option>'; } ?> </select> if wuld display all the dates as 01.02.08 01.02.08 01.02.08 02.03.08 01.02.08 04.02.08 where i need it to do something like if there is more than 1 of the same date then only display one. so it wuld then show 01.02.08 02.03.08 04.02.08 does anyone know how to do this ? (am not very good an explaining stuff so i hope this example helps) i think it has something to do with mysql_fetch_rows but am not entirely sure ive been searching for tips and tutorials for this but cant seem to find any. thanks for any replies Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted March 7, 2008 Share Posted March 7, 2008 Try changing your query to: $sql = mysql_query("SELECT DISTINCT(date) FROM db"); Quote Link to comment Share on other sites More sharing options...
rameshfaj Posted March 7, 2008 Share Posted March 7, 2008 you can also use UNIQUE keyword inplace of DISTINCT keyword,but both do the same functionality. Quote Link to comment Share on other sites More sharing options...
SkullzY88 Posted March 7, 2008 Author Share Posted March 7, 2008 thank you both very much ive been trying to figure this out for a week now could never seem to get it untile now 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.