spoco Posted May 6, 2009 Share Posted May 6, 2009 I have a drop down menu that is dynamically populated from a MySQL database. It is very possible that the field will have repeat names. (e.g. the field is favorite fruit - several users choose apple) On the back end where I am pulling the data, the drop down menu is dynamically populated, and will repeat apple as a choice if it appears more than once in the field. How do I make it where the repeats are ignored? Quote Link to comment https://forums.phpfreaks.com/topic/157097-solved-dynamic-drop-down-menu/ Share on other sites More sharing options...
premiso Posted May 6, 2009 Share Posted May 6, 2009 Yep it is possible depending on how your DB is designed. If you do have repeats (which if you do my bet is your DB is designed wrong) then you can use the DISTINCT keyword in MySQL on the field: SELECT DISTINCT fruit FROM fruits WHERE somecondition = true Quote Link to comment https://forums.phpfreaks.com/topic/157097-solved-dynamic-drop-down-menu/#findComment-827597 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.