i am trying to add a profile based search option into my existing plugin. my plugin already search members by distance within a certain radius and i want to add the option to filter results by profile fields.
what i am trying to do is getting the user id that has the matching values entered in the search form. i am trying something like:
SELECT user_id FROM {$bp->profile->table_name_data}
WHERE (field_id1 = "field1" AND value1 = "value1")
AND (field_id2 = "field2" AND value2 = "value2")
AND (field_id3 = "field3" AND value3 = "valu3")
........
but this doesn't work. it will work with the WHERE clause only but not when i am adding the ANDs. i assume this is have something to do with joins maybe?
any help would be much appreciated.