brentman Posted September 13, 2013 Share Posted September 13, 2013 (edited) I am building a bid function that will display the best available ad inventory to the current user. I have a record for user like so: $user_record = interest, gender, country I am then pulling all available records to array for available ad inventory to find all eligible ads: $ad_array = budget, interest, gender, country (for a whole table) So I want to only pull those with remaining budget (ie like $budget>$.50), if interest is set, only if interest = interest, if gender is set, only if gender = gender, if country is set, only if country=country Now there may be 1 or there may be 20 or more ad campaigns in the array. But I want to remove the ones that do not fit certain rules. //GETS THE USER RECORD $result = mysql_query("SELECT user_record FROM usertable WHERE user_record = '$user_record'"); $row = mysql_fetch_row($result); //GETS ALL AD CAMPAIGNS $query = "SELECT * FROM campaigns"; $result = mysql_query($query); //MAKES ARRAY FOR ONLY ELIGIBLE CAMPAIGNS ????? So what code to I put for the ?????? that will remove ad campaigns that are not eligible, leaving only eligible campaigns in the array? Edited September 13, 2013 by brentman Quote Link to comment https://forums.phpfreaks.com/topic/282116-how-to-find-record-in-array-that-meets-multiple-comparisons/ Share on other sites More sharing options...
Solution brentman Posted September 13, 2013 Author Solution Share Posted September 13, 2013 Solved Quote Link to comment https://forums.phpfreaks.com/topic/282116-how-to-find-record-in-array-that-meets-multiple-comparisons/#findComment-1449329 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.