Your problem is most probably something completely different, as I found out first-hand.
If you are including theses scripts in home.php for example, then
right at the top of home.php, you need to do an include(/homes/whatever/public_html/forum/global.php);
if you don't do it, then your passing it a non-existing servername, so it doesn't return a handle, so everything breaks.
Please note that if you are using lots of these scriptlets (funny word

) on one page, then you only need the one include at the top of the page that includes all the scriptlets.
Also, if you put the global include anywhere else in the file (ie. not top), you'll get a horrible header error.
That's my 2p's worth (UK Sterling you see!)