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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.