from what i see, there is no security problem in the code, just two things to think about
:
1) vb3.5 allows a second connection set up from within config.php afaik, which could make things a bit easier for you
2) are you sure you need TABLE_PREFIX in your query, as you are connecting to a second db, no the vb one, that could produce an error.
as for the security again: yep that's ok, as noone could directly view into the php files and see the pw