ukweb Posted July 30, 2009 Share Posted July 30, 2009 Hi All As per usual I have left everything til too late, and its 1am over here in the UK and my deadline is tomorrow, anywho I can't think how to do this very simple thing... Basically I have a drop down list, and a query. Here's basically what I want to do: in the drop down list is a list of attributes for a property, ie 'Garage', 'Bedrooms', etc etc This is not generated by a database, just listed I have a query that lists attributes already added for a given property, so basically if 'Bedroom' appears in the results for a query, I do not want 'Bedrooms' to appear in the dropdown list... Any ideas how to tackle this one? I thought of populating an array with the results in the database and using the 'if (!(in_array.... show this row in dropdown...' is this the best solution? Ta in advance! xx Quote Link to comment https://forums.phpfreaks.com/topic/168059-solved-dont-show-if-in-database-tired-as-hell-and-cant-think-how-to-do-this/ Share on other sites More sharing options...
vineld Posted July 30, 2009 Share Posted July 30, 2009 I'd populate two arrays and then use array_diff. Quote Link to comment https://forums.phpfreaks.com/topic/168059-solved-dont-show-if-in-database-tired-as-hell-and-cant-think-how-to-do-this/#findComment-886412 Share on other sites More sharing options...
patrickmvi Posted July 30, 2009 Share Posted July 30, 2009 As you're looping through your query results, remove the found items from your master array. Quote Link to comment https://forums.phpfreaks.com/topic/168059-solved-dont-show-if-in-database-tired-as-hell-and-cant-think-how-to-do-this/#findComment-886416 Share on other sites More sharing options...
ukweb Posted July 30, 2009 Author Share Posted July 30, 2009 I'd populate two arrays and then use array_diff. I didnt even know that function existed! will check it out now, thanks! Quote Link to comment https://forums.phpfreaks.com/topic/168059-solved-dont-show-if-in-database-tired-as-hell-and-cant-think-how-to-do-this/#findComment-886421 Share on other sites More sharing options...
ukweb Posted July 30, 2009 Author Share Posted July 30, 2009 Ta very much everyone. I made two arrays and removed from the master array the values in the secondary array, and populated the dropdown list from the master. Thanks again all. I'm off to bed now, Night Night!!! Quote Link to comment https://forums.phpfreaks.com/topic/168059-solved-dont-show-if-in-database-tired-as-hell-and-cant-think-how-to-do-this/#findComment-886452 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.