What causes pain in your ribs or sides?

Many things. Too many things to guess...You'd need to see a doctor. This could anything from a bruised rib or pulled muscle, to a kidney stone, gallbladder problem, or lung problem. More details may be helpful, but most pain in the chest (even chest wall) and abdomen should be evaluated by a doctor.