Sorry but no. Do not use the trainer online. Note if I come across anyone online doing the same. I will report Them. Sorry but the trainer is not made to be used online! So do not use it online. Heck if you are not going to invide why are you even in that mode anyway!
Stay hollow and the likelihood of being invaded is nil (Don't become human in other words). It doesn't matter if you're online or not. As long as you don't invade anyone else and you don't have lots of sin (killing lots of NPCs) then you don't have to worry about being invaded.
You can also get sin from attacking (but not killing) NPCs and/or changing covenants without having your sin expulsed by the guy in the bell tower over the Undead Parish.