Rsmiley Posted February 21, 2012 Share Posted February 21, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/257487-wordpress-wpdb-num_rows-help/ Share on other sites More sharing options...
Rsmiley Posted February 21, 2012 Author Share Posted February 21, 2012 Since I can't edit my original post, the title is misleading, I'm sorry. Quote Link to comment https://forums.phpfreaks.com/topic/257487-wordpress-wpdb-num_rows-help/#findComment-1319701 Share on other sites More sharing options...
xyph Posted February 21, 2012 Share Posted February 21, 2012 http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing Quote Link to comment https://forums.phpfreaks.com/topic/257487-wordpress-wpdb-num_rows-help/#findComment-1319740 Share on other sites More sharing options...
Rsmiley Posted February 22, 2012 Author Share Posted February 22, 2012 http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing I'm sorry, I don't understand Quote Link to comment https://forums.phpfreaks.com/topic/257487-wordpress-wpdb-num_rows-help/#findComment-1319779 Share on other sites More sharing options...
darkfreaks Posted February 22, 2012 Share Posted February 22, 2012 i think what he is trying to say is put curly braces around your variables in the MYSQL code to escape it. Quote Link to comment https://forums.phpfreaks.com/topic/257487-wordpress-wpdb-num_rows-help/#findComment-1319929 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.