Based from the information provided it seems like the "DISK PROLAPSE"
is needed to check the space between two spines and any prolapse of disk can be detected.
Now their is the narrow passage from which nerves passes in and out of the spinal cord
, and the bones knows as spine are supported by spongy matter known as DISKS, now the prolapse of such disk will decrease the space for the nerve exiting out and in turn will compress nerve, such compression is cause of the pain you are suffering from and the nerve will case pain sensation where it passes to supply the part of body such as ribs.
So yes the sharp rib pain
is from the compression of the nerves due to "DISK PROLAPSE/ bulging"
Hope it clears the understanding of the process.
Dr. JAY PATEL