Sounds like a UTI (urinary tract infection). The discharge is normal for a UTI. Not saying that's what you have, but from what you're describing, it's likely.
Easy to rid yourself of this... go ad see your PCP or a Urologist, and they'll give you some antibiotics.
Sorry for the bad news, but try not to masturbate until it clears up. You'll only make the infection last longer and aggravate the situation.
Read here, for more information: http://www.hmc.psu.edu/healthinfo/uz/uti.htm
Go see a doctor, and good luck!
The first possibility is of urinary tract infection. Drink plenty of fluids and get your complete urine examination and urine culture done. The other possibilities are of STD’s like Chlamydia, Kidney conditions (infection, pyelonephritis, kidney stones, polycystic kidney disease), Bladder conditions (cystitis, bladder polyp, bladder tumor), Urethral conditions (Sexually transmitted diseases, urethral injury, vaginal inflammation), and certain bleeding disorders.
Diagnostic tests that may be performed include Urinalysis, Urine culture, X-rays of the kidneys, Cystoscopy, IVP, swab culture of the discharge and CT scan of the abdomen.
It is very difficult to precisely confirm a diagnosis without examination and investigations and the answer is based on the medical information provided. For exact diagnosis, you are requested to consult your doctor. I sincerely hope that helps. Take care and please do keep me posted on how you are doing.