Hi clover, having this exact trouble with DD who is 6.. We were in emergency on Tuesday night. She was having such bad stomach pain and was not able to keep any food down.. They did an ultrasound, urine test, blood test, physical exam, X-ray etc and found that she was very constipated..
this is apparently quite common in kids of this age because they get distracted or hold off on going to the toilet because they are doing something more interesting, which will cause their poos to become hard and compact, so it hurts to poo, and then they hold on to their poos because it's hurts and it's a revolving cycle until it get to the point where they are having bad tummy pains and start to vomit because their body is refusing to hold any more food... DD was at a friends house all day Saturday and we went out on the boat on Sunday and the pain started Sunday evening and got progressively worse Monday and Tuesday to the point where we took her to the hospital..

Doctors suggested we encourage her to sip on water or hydralyte/watered down powerade, and not to try and make her eat, if she wants food then make sure it is something as bland as possible..

To help clear constipation you can try Coloxyl, it's for infants and will not harm in any way even if they do not have constipation, this is just over the counter medication.. It has been working for us.

If your childs pain isn't localized their appendix area and they aren't running a fever then it could just be the same thing!
Also if it is appendicitis they will not want to more and will try to stay as immobile as possible.. If it's constipation they may be squirmy because they are looking for a comfy position..