I am pretty sure this does not work. This will select forum_password of the second row, which does not exist. Use sql_fetchrow, also select the forum_id, fetch into $forum_data array and pass that to the login function.