Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Wordpress query usermeta with additional fields

Posted on 2013-06-26
6
Medium Priority
?
547 Views
Last Modified: 2013-06-27
Hey Experts!!

I have a query below that is working, however I need more information from different tables.

Can someone help or show me how to add additional tables to the query?

The fields I need are first and last names, along with 2 other fields in the s2member custom fields.  My end result would be to have only the users where the meta_value is equal to executive board and then list only those members out on the page. There are 3 total now and the query is showing those 3 in my for each, but I need additional data.

$users = $wpdb->get_results ("SELECT * FROM `" . $wpdb->usermeta . "` WHERE `meta_key` = '" . $wpdb->prefix . "s2member_custom_fields' AND `meta_value` REGEXP '.*\"member\";s:[0-9]+:\"executive board\".*'");

Open in new window

0
Comment
Question by:LZ1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 82

Expert Comment

by:hielo
ID: 39280875
Try:
$users = $wpdb->get_results ("SELECT U.display_name, U.user_nicename, U.user_email, U.user_status, M.* 
				FROM `" . $wpdb->usermeta . "` M INNER JOIN `" . $wpdb->users . "` U ON M.user_id=U.ID
				WHERE (`meta_key` = '" . $wpdb->prefix . "s2member_custom_fields') 
				AND `meta_value` REGEXP '.*\"member\";s:[0-9]+:\"executive board\".*'
				");

Open in new window


I did not see separate fields for 'firstName', 'lastName'.  I suspect that either display_name or user_name has what you are interested in.
0
 
LVL 30

Author Comment

by:LZ1
ID: 39281489
I'm not an SQL guy by any means. So I'm getting this as a response:
http://goo.gl/nOx1U 

Can you tell me why it's not returning only members with the "executive board" value?
0
 
LVL 30

Author Comment

by:LZ1
ID: 39281607
The fields I ultimately need would be in the wp_users and wp_usermeta tables. I need to only show people that have the executive board value in the wp_usermeta table. But I need the rest of the information as well to display on page.

I've printed out the 2 arrays I need on the page. I just need to know how to access things...
0
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

 
LVL 82

Expert Comment

by:hielo
ID: 39281683
I don't know what you are referring to.  The link you provided above requires me to register to some site using paypal.
0
 
LVL 30

Author Comment

by:LZ1
ID: 39282095
I forgot about that. Sorry.  

Here are the arrays:

Custom fields I need

        Array
(
    [0] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => first_name
            [label] => First Name
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [1] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => last_name
            [label] => Last Name
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [2] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => job_title
            [label] => Job Title
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [3] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => company
            [label] => Company
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [4] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => phone
            [label] => Phone
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [5] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => mobile
            [label] => Mobile
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [6] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => zip_code
            [label] => Zip/Postal Code
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [7] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => company_website
            [label] => Company Website
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => no
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [8] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => firm_type
            [label] => Firm Type
            [type] => radios
            [deflt] => 
            [options] => GP-buyout | GP: buyout
GP-venture | GP: venture
GP-mezzanine | GP: mezzanine
GP-distressed-credit | GP: distressed credit
GP-growth-equity | GP: growth equity 
---------- | ---------------------------------------------------------------
LP-Endowments-Foundations | LP:Endowments/Foundations
LP-Fund-of-Funds | LP:Fund of Funds
LP-Consultants | LP:Consultants
LP-Insurance-company | LP:Insurance company
LP-Public-Pension | LP:Public Pension
LP-Corporate-Pension | LP:Corporate Pension
LP-Family-Office-Wealth management | LP:Family Office/Wealth management
Placement Agent | Placement Agent
Attorney | Attorney
Other service provider | Other service provider
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [9] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => assets_under_management
            [label] => Assets Under Management
            [type] => select
            [deflt] => 
            [options] => N/A | N/A
<$150MM | <$150MM
$150-$250MM | $150-$250MM
$250-$500MM | $250-$500MM
$500-$1bn | $500-$1bn
$1-$2.5bn | $1-$2.5bn
$2.5-$5bn | $2.5-$5bn
$5bn+ | $5bn+
            [expected] => 
            [required] => no
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [10] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => firm_description
            [label] => Brief description of your firm and its approach to private equity investing
            [type] => textarea
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [11] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => describe_your_role
            [label] => Describe your role within the firm
            [type] => textarea
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [12] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => address
            [label] => Address
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [13] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => Address2
            [label] => Address 2
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => no
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [14] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => City
            [label] => City
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [15] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => State
            [label] => State
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [16] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => Country
            [label] => Country
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [17] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => geo_areas
            [label] => Geographical areas of interest
            [type] => checkboxes
            [deflt] => 
            [options] => Asia | Asia
US | US 
Europe | Europe
Emerging Markets | Emerging Markets
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [18] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => BIO
            [label] => BIO
            [type] => textarea
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [19] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => investment_areas
            [label] => Investment areas of interest
            [type] => checkboxes
            [deflt] => 
            [options] => Buyout | Buyout, 
Venture | Venture
Mezzanine | Mezzanine
Distressed Credit | Distressed Credit
Growth Equity | Growth Equity
Coinvest | Coinvest
Real Assets | Real Assets
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [20] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => member
            [label] => Member Of
            [type] => radios
            [deflt] => 
            [options] => executive board|Executive Board
steering committee|Steering Committee
            [expected] => 
            [required] => no
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [21] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => linkedin
            [label] => LinkedIn
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => url
            [required] => no
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

    [22] => Array
        (
            [section] => no
            [sectitle] => 
            [id] => fb_url
            [label] => Facebook
            [type] => text
            [deflt] => 
            [options] => 
            [expected] => 
            [required] => yes
            [levels] => all
            [editable] => yes
            [classes] => 
            [styles] => 
            [attrs] => 
        )

)
My Member Of is executive board.     

Experts Exchange Array

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

            Array
    (
        [0] => stdClass Object
            (
                [display_name] => Pewin
                [user_nicename] => pewin
                [user_email] => cyentistsma@gmail.com
                [user_status] => 0
                [umeta_id] => 627
                [user_id] => 1
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:3:{s:10:"first_name";s:5:"Pewin";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [1] => stdClass Object
            (
                [display_name] => Test test
                [user_nicename] => test
                [user_email] => lzscomputers@aol.com
                [user_status] => 0
                [umeta_id] => 34163
                [user_id] => 2147
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:7:"Testing";s:9:"last_name";s:6:"tester";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

        [2] => stdClass Object
            (
                [display_name] => Sylvia
                [user_nicename] => sowenscvp7-com
                [user_email] => sowens@cvp7.com
                [user_status] => 0
                [umeta_id] => 32846
                [user_id] => 2074
                [meta_key] => wp_s2member_custom_fields
                [meta_value] => a:4:{s:10:"first_name";s:6:"Sylvia";s:9:"last_name";s:5:"Owens";s:23:"assets_under_management";s:3:"N/A";s:6:"member";s:15:"executive board";}
            )

    )
                

Open in new window


I just need to know how to access the values inside of the arrays.
0
 
LVL 82

Accepted Solution

by:
hielo earned 2000 total points
ID: 39282236
Let's say that you have a variable named $data which is initialized to the array that you have on lines 456-494.  This is how you get to the elements:
foreach($data as $i=>$item)
{
	//the 'meta_value' element in each $item is a serialized PHP array, so you need to unserialize it first
	$temp=(object)unserialize($item->meta_value);
	
	//THEN you can just echo the values.
	echo $temp->first_name.'<br>';
	echo $temp->last_name.'<br>';
	echo $temp->assets_under_management.'<br>';
	echo $temp->member.'<br>';
	
	//the other elements in $item - ex: display_name, user_nicename, etc. have literal values (number,string), NOT a PHP serialized array, so there is no need to unserialize anything from them.
	echo $item->display_name.'<br>';
	echo $item->user_nicename.'<br>';
	echo $item->user_email.'<br>';
	echo $item->user_status.'<br>';//etc
	
	
}

Open in new window

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to implement server side field validation and display customized error messages to the client.
In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question