Baby gets spit up every time I give him gripe water

So LO has been having stomach ache and 3 days between his bowel movements. And this time he produces gas but first feels pain. I have gas drops but don't seem to help much. So purchased gripe water. Of the two times I have given it to him, he has had spit up. Now my baby doesn't usually get spit up. And am never sure if I should give him again or not after he brings it back. Because it means he ain't getting it for his stomach pain. Yet there must be a reason he can't keep it down.