Hello Karin - I think your doctor is correct, and that you appear to have what is usually called costochonritis, or an inflammation of the cartilege between your ribs. If the ibuprofin (Advil, Motrin) is upsetting your stomach you might want to buffer that with over-the-counter ranitadine (brand name Zantac) as there is little else that will help this problem, and it can be rather persistent.
Bear in mind, please, that cardiac pain will not be worsened by deep breathing, sneezing, nor twisting of the upper body, but costochondritis definitely will. It is a very common problem and often mistaken for cardiac pain, but the motion test (moving the upper body, deep breathing or sneezing - this last hard to provoke on purpose but a handy diagnostic marker) moves the focus away from the heart and straight to the cartilege between one or more pairs of ribs. It will go away eventually, but there is no strict schedule, especially if it is caused by a passing virus, which is often the case.
Good luck to you and no cause for concern.
John Kenyon, EMT, CCT
Non-invasive cardiology tech, Emergency and Critical Care technician, Critical Incident Stress Mgmt. specialist