Search Query and MySQL help
I’m attempting to make a custom search page that lets users browse through the members directory based on certain custom xprofile fields that they select in the search form. I have 3 custom xprofile fields: Member Type, Gender, and Location. With the way the database table (bp_xprofile_data) is setup, all of those values (under the ‘value’ column) are stored in different rows within the same table with corresponding xprofile ID’s (under the ‘field_id’ column).
For the life of me, I can’t figure out how to filter results based on these multiple parameters when they aren’t listed within the same row, but are listed within the same table. For example, normally I would simply query “SELECT user_id FROM bp_xprofile_data WHERE xprofile1=’General’ AND xprofile2=’Male’ AND xprofile3=’Los Angeles’”…..but I can’t do that because of the way the table is setup and the info is organized.
So how do I format the query? Do I need to use subqueries (if so…I’m lost on where to go with those!)? To sum up: How do I filter search results from bp_xprofile_data through a MySQL query matching multiple xprofile values?
I’ve been working on this for 4 hours and I’ve done more research than I care to admit, especially because this is probably a much easier solution than I realize. Any help would make you the coolest person alive. Seriously!
You must be logged in to reply to this topic.