Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Display filtered overview of members

@barodscheff

Participant

Thank you for your answers.

I’ve tried the example from the wordpress codex:
$user_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->users" );

It works even when I do not use global $wpdb;.
First question: Why does it work without global $wpdb?

Second question: Why do I have to use $wpdb->bp_xprofile_data instead of $wpdb->ar_bp_xprofile_data? Does the prefix do not belong to the name? When I try the query in phpmyadmin I also have to use the prefix.

Unfortunately my own queries still not work. I simplified my query now:

global $wpdb;
$male = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->bp_xprofile_data");
echo $male;
Skip to toolbar