Welcome to WebmasterWorld Guest from 18.104.22.168
Forum Moderators: open
$query = "SELECT * FROM `venues`, `events` WHERE `venues`.`vid` = `events`.`venue` AND (`type` LIKE '%Concert%')"
This query is called when a user searches for a specific event type, like "Concert." It is supposed to return all venues that have events with "Concert" in their types array.
It works fine, but the problem is if a venue has two events with the "Concert" type, this query returns the venue twice. I tried adding a check within the mysql while loop to make sure a venue isn't displayed twice, but because this is outside of the query, it interferes with my pagination. (i.e., if it's set to display 3 results per page, it will sometimes only display 2 because it filters out the duplicated venues without changing the query).
So, is there anything I can add directly to the query in order to make sure that a venue is not displayed more than once?