I want to ask if this sentence is acceptable:
As I only saw sentences with 只要 in which the condition brings about a result (poisitive) but here the result is negative. Is it a correct sentence?
Yes, it is acceptable.
As long as someone is talking, do not intervene.
As long as it rains, we will not go.
If customers are not satisfied, we will not stop the service.
It's acceptable.I think that you express it this way "只要我头还疼，就没（办）法去上课。"would be better.It could be less stiff.It sounds like that you are forced not to go to school.
只要refer to sufficient condition
只要A，就B：if A then B
it has nothing to do with positive or negative conditions