How to handle custome tables in db in multi-db environment?

I have added a number of custom tables to our database, and when started using the multi-db plugin, all the themes that are using these custom added tables started giving errors such as: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /usr/home/webcv4me.com/htdocs/wp-content/themes/temp02/header.php on line 45

How to handle this case with multi-database plugin

Thanks