I am creating simple displaying lists of uses in wordpress. I am using below code for that
$results = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->users WHERE name = %s",$name);
This above query is not working because of ” $wpdb->users ” that is table name but when I use only “users” that is table name it works.
Please help me whether am I missing something in the code
use
$wpdb->query($wpdb->prepare("..."))
instead.Reference: https://codex.wordpress.org/Function_Reference/wpdb_Class