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

?>

<div class="item_smallcolumn"><?php echo $film_rank; ?></div>
<div class="item_smallcolumn"><?php echo $film_lastmovie; ?></div>
<?php
}
?>


ERROR:

( ! ) Fatal error: Call to a member function get_results() on a non-object in C:\\wamp\\www\\movie\\wp-content\	hemes\\reviewit\	est.php on line 4
Call Stack
#	Time	        Memory	Function	Location
1	0.0019	251280	{main}( )	..\	est.php:0

Any help appreciated. Thanks