After the cold virus has gone away then the phlegm you are coughing up can last for 1 to 2 weeks and in some cases depending on how severe the cold was the phlegm can easily last for 4 weeks.
In my experience though I usually cough up phlegm after a cold for 2 weeks and by then the phlegm is completely gone.
If you're still coughing up phlegm after 4 weeks then you might have bronchitis and should see a doctor or you may have a more severe cold.