• Hi guys!
    I would like to echo all members that have certain variables. In this i need to combine two tables: wp_mngl_custom_field_values (mingle script) and then wp_users.

    Okay, first i need to select all user_id’s that have a certain value, from the table wp_mngl_custom_field_values

    Second, i need to get all the user_login’s (usernames) that are connected with the above collected id’s.

    Third, i want to echo the above collected user_login’s.

    I guess i need some kind of FOREACH function here. I tried a lot already (found some help here: https://codex.www.ads-software.com/Function_Reference/wpdb_Class, see:SELECT Generic Results) but i seem to do something wrong. This is what i have got now:

    $user_idd = $wpdb->get_results("SELECT user_id FROM wp_mngl_custom_field_values WHERE value='Winter'");
    foreach ($user_idd as $user_idd) {
    $user_naam = $wpdb->get_results("SELECT user_login FROM wp_users WHERE ID='$user_idd'");
    
    echo $user_naam->user_login;
    }

    The above code is after i tried several things, so it might be a bit messy or it might be almost working ??

    Anyone? Thanks a lot!

Viewing 2 replies - 16 through 17 (of 17 total)
Viewing 2 replies - 16 through 17 (of 17 total)
  • The topic ‘Echo all members function WHERE value='' ?’ is closed to new replies.