Ok so I'm being stupid...

In index.php:

require_once("ez_sql.php");
require_once("mailfunction.php");
require_once("functions.php");

then in functions.php :

$db->debug();
$db->get_var("SELECT count(*) FROM settings");

The result:
Fatal error: Call to a member function on a non-object in /functions.php on line 5

Can someone please point me in the right direction?

PHP 4 Apache 1.3 if it helps at all. And I've been using the damned class for years and never had a single problm. Not sure what I'm missing.

Thanks in advance