for(Project_Milestone__c b: [Select id,name,Project_Milestone_Percent__c,Payment_Schedule_Template__c,phase__c From Project_Milestone__c WHERE Payment_Schedule_Template__c =:
PS_nomal ORDER BY Project_Milestone_Percent__c DESC ])


The code you posted only has 5 SOQL statements and none of them are in a for loop. The problem could be in any piece of code that executed before this code. The error is saying that you have done 101 SOQL statements and only 100 is allowed.

Have a look at your debug logs and you should see some SOQL that repeats a lot. That will be the code that needs to be refactored. See How do I start to debug my own Apex code? for more information on debugging.

Not the answer you're looking for? Browse other questions tagged or ask your own question.