Hi,
Welcome to health care magic,
Stomach ache is a commonest symptom seen nowadays.
Your brown coloured,semi solid stool should not be a big concern.
The causes of stomach pain could be excess stomach acid or
acute gastritis,
gastroenteritis,gastric ulcer or
Helicobacter pylori infection or
food allergy or drug induced.
You must undergo routine blood investigations and H.pylori,liver function tests,urinalysis and stool for blood,abdominal ultrasound and upper gastrointestinal endoscopy to detect the underlying cause.
Treatment is mainly depend on the cause but you may take symptommatic treatment meanwhile.
Antacids like H2 blockers (ranitidine) or proton pump inhibitors (pantoprazole or rabeprazole) will help to reduce excess acid production in stomach and will help to relieve from pain.
You may also require deworming drug like albendazole for once with antibiotics(quinolones and antiprotozoals combination).
You should take digene gel or liquid or ulcero-protective agents like sucralfate or bismuth subsallicylate to reduce the burning or pain sensation.
Consult gastroenterologist for further advise and treatment.
Thanks and regards,