0

I need to count the number of value 1 from wp_ul_locked on wp_usermeta i try this code

$wpdb->get_var("SELECT COUNT(*) WHERE 'meta_key' LIKE 'wp_ul_locked'");

or

$wpdb->get_var("SELECT COUNT(*) FROM $wpdb->usermeta WHERE meta_key = '1'");

or

$wpdb->get_var("SELECT COUNT(*) FROM $wpdb->usermeta LIKE 'wp_ul_locked' WHERE meta_value = '1'");

but return empty or error

example of table

Where is my error?

0

1 Answer 1

0

Try it like this:

$wpdb->get_var("SELECT COUNT(*) FROM $wpdb->usermeta WHERE `meta_key` = 'wp_ul_locked' AND `meta_value` = '1'");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.