I had the same thing last year. It worried me alot too, especially since I have really bad stomach pain. Very good idea to go to the doctor, mine ended up not being as bad as a thought. After a flexible sigmoidoscopy, the doctor determined it was an internal bleeding hemmoroid. Made sense to me. Hope yours turns out well.
I agree completely with the advice you have been given. It is VERY important that you get this checked out.
Anytime there is blood in the stool or in the toilet bowl, it is cause for concern. With that said, this may be not be serious. However, it is cause for attention. You need to see your family doc and/or a gastroenterologist (GI specialist) so they may get your medical history and run the proper tests. There are different causes for blood in the stool/rectum, some are not serious and some are. So, your best bet would be to seek medical attention at your earliest convenience. It doesn't sound like an emergency, considering this has been going on for "a couple of years", but you should make it a priority. Take care and good luck!
J.C.I.