Had pitting on a nail and now it looks like its detaching. Doc gave me ciclopirox topical solution but it hasn't helped. What should I do? What can it be

Depends. Nail pitting can be seen in psoriasis and patients can sometimes lose a nail as a result. Ciclopirox is a topical antifungal medicine and won't do anything unless your problem is due to a fungus. Having a dermatologist look at you will help determine what exactly is going on.