This medical problem can occur in both adults and children. They can be due to skin infections of the outer ear or ear canal. Often they occur after swimming, commonly known as "swimmers ear."
Infections in the middle ear are very common in infants and young children. If an earache lasts more than a few hours, one should seek medical attention.