Hi.
The causes of stomach pain with loose motions is usually an infection of the intestines in the form of
gastroenteritis or colitis or procto-colitis. Occasionally Gastrointesinal cancers can this problem, the diarrhea then is a spurious one due to a mass and allowing only liquids to pass down.
This is least possible to have an ulcer as a cause of your problems.
I would advise you The following:
The most probable treatment for such an
Abdominal Pain with Diarrhea , a waterborne disease can be a course of an antibiotic,
Metronidazole, Tablets against worms, anti-spasmodics, Probiotics and supportive therapy.
If there is no relief within a few days you can go for consultation of a Surgical Gastroenterologist and Investigations like that of stool, blood, urine,
ultrasonography and CT scan of the abdomen.
There is a possibility of Gastrointesinal Cancer that has to be ruled out.
Colonoscopy or Upper GI Endoscopy can be planned according to the CT scan report for diagnosis, biopsy and treatment plan.