Jump to content

WordPress $wpdb->num_rows() help


Rsmiley

Recommended Posts

I'm trying to write a plugin and when trying to see if a user ID is in an approved users table it does not want to cooperate. It doesn't error on any other $wpdb just this one.

 

I'm not sure whats wrong, then again, I'm fairly new to OOP and WP

$wpdb->get_row("SELECT * FROM $wpdb->re_approvedusers WHERE user_id=$userid");

 

Full function code


function re_approved_user_verify($userid) {
global $user_ID, $wpdb;
//$userid = $this->re_secure($userid);
$re_check = $wpdb->get_row("SELECT * FROM $wpdb->re_approvedusers WHERE user_id=$userid");
if($re_check == 0 || $re_check == NULL) {
$success = 0;
} else {
$success = 1;
}

return $success;
}

Can anyone tell me what the problem is?

$userid is obtained via the function if you're wondering.

 

ERROR:

Fatal error: Call to a member function get_row() on a non-object in /home/.../wp-content/plugins/re/functions.php on line 64

 

Link to comment
https://forums.phpfreaks.com/topic/257487-wordpress-wpdb-num_rows-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.