Hi welcome to HCM
I can understand your concern for your child ' suffering from 
diarrhea upon intake of food .
Dear , I like to suggest you not to worry much  . As this is his 
teething stage  and  this is a common phenomena with infants . They suffer from loss of appetite  ,loose motions ,  headache  , fever etc .
 A lot of  other things can cause the problem, including: An infection with a virus, bacteria, or parasite. Babies can pick up these germs through contact with unclean food or water or when they touch germy surfaces and then put their hands into their mouths. .
The other reasons having diarrhra are :
A 
food allergy or sensitivity to medicines
Diarrhea makes the body lose too much water and minerals called electrolytes. That leads to 
dehydration. Babies can get dehydrated and weak  very quickly . 
Look into the causes and try to remove them as much as you cam 
So , Take care of his cleanliness  .Wash and wipe his hands quite often.
Over medication  should be avoided .
Liquids - water , milk  juice should be given in small portions frequently . 
Give him small solid meals  like porridge , 1 banana with little curd  -1/4th of it every 2 hours   
 A 
Homeopathic remedy , Chamomilla  30  / 3 drops in a cup of water  / a spoon or 2,  every  1  hourly of this mixture / 4 doses  . 
After that , a dose / every  2 hourly  3 doses .
And after that , a dose  every day helps the child in resolving teething   prolems - pains -  headache, 
stomach upset ,
sleeplessness and assures cheerful teething . 
Please don't panic , your child will pick up normal health  ,  starting with in ,2-3 days  very soon . 
Consult his doctor every off and on for his proper growth . 
Wish you all the best 
Hope this helps solve your query 
Dr Suchda