Okay, but my code doesn't look like that.

But think I got it right with what I tried before. It still says Query failed though. So I think I have it in the right place in ubbthreads.tmpl, the problem is somewhere else.
I'm using this for ReviewPost, BTW. I filled-out and uploaded reviewpost.inc.php to the folder above my root. This is where I keep my config.inc.php file, and the instructions said to put it in the same folder. For good measure, I copied the file to my threads directory as well, but that did not help.