get_var() on a non-object $wpdb
-
I am trying to write a plugin that access the database but all I get is
“Fatal error: Call to a member function get_var() on a non-object in C:\xampp\htdocs\wp-content\plugins\audio-comments\audio-comments.php on line 228”none of the examples work
help
// mt_comments_page() displays the page content for the audio comments Options submenu
function mt_comments_page() {echo “<div class=\”wrap\”>”;
echo “<h2>Audio Comments Manage</h2>”;
// example code starts here
$name = $wpdb->get_var(“SELECT cat_name FROM $wpdb->categories WHERE cat_ID=4”);
echo $name;
// example code ends here
echo “</div>”;
}
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘get_var() on a non-object $wpdb’ is closed to new replies.