Colds cause swelling and inflammation in the sinuses and eustachian tubes. Children's eustachian tubes are shorter and narrower than adults. This size makes it more likely that inflammation will block the tube completely, trapping fluid in the middle ear. This trapped fluid causes discomfort and creates an ideal environment for bacteria to grow. The result is a middle ear infection.
Bacteria cause most ear infections.
However, viral illnesses may contribute to ear infections. Viruses can cause changes in the lining of the respiratory tract, increasing secretions and decreasing middle ear drainage. Although an ear infection isn't an emergency, the first 24 hours are often when the pain is the worst. Consider eardrops containing a local anesthetic. They may help reduce pain but they won't prevent or stop an infection.