Sometimes it's viral and sometimes it's bacterial. Your doc will prescribe on the basis of duration of symptoms and the color of the discharge.
Hope you feel better soon.
Sometimes Benadryl will hold down that cough. Edited to mention that this is a PERSONAL usage, not prototypical.