I would suggest you change the way your trying to do this.
Intead of adding to the users and forum topic tables create a new table where you can record the userid, topic id, liked, dislike
Then when a player likes or dislikes a topic you can record it in this new table. Which in turn makes it easier to then check for that topic ID.
Also......why are you putting the code in a different file. Create a new forum function.