Wordpress Custom Code to access custom table errors
Hi, I am new to wordpress and its functions. I had created a custom table in existing wordpress database and trying to create this new page but it's not working at all. The code is
<?php
global $wpdb;
$querystr = "SELECT * FROM wp_boxoffice";
$film_list = $wpdb->get_results($querystr);
foreach ($film_list as $film) {
$film_rank = $film->id_rank;
$film_lastweek =$film->id_movie;
// id_rank, id_movie are two fields in the table out of 6 fields
( ! ) Fatal error: Call to a member function get_results() on a non-object in C:\wamp\www\movie\wp-content\themes\reviewit\test.php on line 4
Call Stack
# Time Memory Function Location
1 0.0019 251280 {main}( ) ..\test.php:0
Bookmarks