Count the number of rising edges

May i know what's wrong with the code as it won't stop counting the positive edge on encoder A. I only want it to count once when there is a rising edge of z encoder.

Which pin is the z encoder connected to? Where are you detecting the RISING edge of that pin? The only thing I see you doing is determining if pin 3 IS high (not BECAME high).

It's pretty dumb to check that pin 2 is HIGH in the ISR. The ISR would not have been called unless pin 2 just went HIGH.

Serial.print() has no place in an interrupt handler.