It appears most likely that you are suffering from the condition called Irritable Bowel Syndrome. It may present in different ways, one of the commonest ways is to present as an alternating diarrhea and constipation. Stools can also have variable consistency. It is an easily treatable condition, and will require some lifestyle changes, and specially some changes in your diet. However, you do need to consult your doctor, two other conditions which are similar, but which do not seem likely in your case, are ulcerative colitis and Crohns disease. You will have to rule them out, plus your doctor can start your treatment. You can look up these sites for more info: http://www.mayoclinic.com/health/irritable-bowel-syndrome/DS00106 http://digestive.niddk.nih.gov/ddiseases/pubs/ibs/
I hope this answer was helpful. If you need more information, feel free to ask. For accepting this answer, please click on the green 'accept' button below. Feedback/Bonus will be warmly appreciated.