Mackenzie Phillips will take it one day at a time for 18 months

TV star Mackenzie Phillips pleaded guilty to one count of felony cocaine possession in a Los Angeles court Friday, and agreed to enter an 18-month rehab program.

"I'd like to take this opportunity to thank [law enforcement] for stopping me, and probably saving my life," Phillips, who was formally charged with two felonies, said to Judge Keith L. Schwartz.

If Phillips successfully completes her drug treatment, the whole case will be dismissed.

Phillips, 48,  was arrested in Aug. for drug possession at Los Angeles International Airport. She was in possession of heroin and cocaine in baggies and balloons," airport police said.

Phillips starred with Bonnie Franklin and Valerie Bertinelli as Julie Cooper on the  late 70s early 80s sitcom "One Day At A Time."