Problem getting the total number of results working

I have been hacking around with this for hours.

I have setup a viewResults script with a query that looks like this

$ezr->query_mysql('SELECT * from PATCH_REQUESTS');

Then I just simply display it.

When I run I get 2 errors:
Notice: Undefined variable: db in C:\cgi-bin\EVT_MANAGEMENT\includes\ez_results.php on line 614

Fatal error: Call to a member function get_var() on a non-object in C:\cgi-bin\EVT_MANAGEMENT\includes\ez_results.php on line 614

FYI....Line 614 refers to the function get_num_results()

By commenting out line 185 of the ez_results script....
// get total number of results
//$this->get_num_results("$query");

I am able to get data, but the results obviously don't count and therefore I am limited to just one page of results.

The next thing I tried was declaring a global variable called db in the
get_num_results() function.

Doing this gives me no data, and an error message.

SQL/DB Error -- [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '100' at line 1]

Any help would be great!
Thanks
Greg