Skip to:
Content
Pages
Categories
Search
Top
Bottom

MySQL Query Question


  • Wythagy
    Participant

    @wythagy

    Alright I am not the greatest when it comes to PHP/MySQL in general. I am trying to make my own Search page that will let you search for multiple profile fields at the same time via a form. However, I can’t wrap my head around how to do this in the current setup. What is confusing me is that all of the extra profile values are in the same column (called “values”) but they are separated by rows differentiated by “field_id”.

    So, I am trying to do a query like:

    SELECT * FROM wp_bp_xprofile_data WHERE value LIKE ‘%–MY SEARCH PARAMS–%’

    Problem is, the search parameters are all in the same column, “value” but all in different rows? So how do you select from the same column, but from different rows? How do you overcome this problem? I am totally confused and could use some general guidance!

Viewing 4 replies - 1 through 4 (of 4 total)

  • Wythagy
    Participant

    @wythagy

    I’m sure someone has got to have some helpful input?


    peterverkooijen
    Participant

    @peterverkooijen

    I need to figure this out as well. I think this thread has some clues.

    How does this work in WPMU/BP? Where are the queries anyway? Should we use WPMU/BP specific tags/code instead? Are there code examples of common database requests somewhere?

    Any pointers are very much appreciated.


    Burt Adsit
    Participant

    @burtadsit

    First it would be nice to know what version of bp you are using. The latest trunk has lots of template functions and a new template class for the xprofile component.

    Frankly the profile component is complicated in that it uses three tables to organize and get access to profile field data. Fields are accessed first by field group then field id then field value.

    I don’t think that anyone is going to waste time on a detailed tutorial for RC1 code. Look at the following files and you’ll get an initial idea of how to access the profile fields.

    /bp-xprofile/bp-xprofile-templatetags.php

    /bp-xprofile/bp-xprofile-classes.php

    With the template tags file being the most useful probably and the classes showing you how things are organized.


    Burt Adsit
    Participant

    @burtadsit

    /buddypress-member/profile/profile-loop.php shows usage of the xprofile template tags.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘MySQL Query Question’ is closed to new replies.
Skip to toolbar