Controlling Rotations

I have trouble in controlling only certain objects that I have drawn. For example, take a look at this pseudo-code:

glRotatef(rotateSquare)
glBegin(GL_QUADS)
Square vertices
glEnd

glBegin(GL_TRIANGLE_FAN)
glEnd

My triangle fan is also being rotated. Why is that? What can I do to restrict the rotation to only the square?

use glPushMatrix() + glPopMatrix() to enclose the various drawing stuffs check the red book for what they do