Back Pain and gas!

My back has been hurting so bad I haven’t even been to sleep yet! I had really bad gas, that was causing bad pains in my belly and behind my rib cage.. the same night as the back pain. Can gas cause back pain so bad you cry?