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?