Finding pitch and yaw angles

I have a (hopefully) simple questions. I’m trying to get the pitch and yaw angles for a camera from the (x,y) mouse position so I can update my LookAt vector (for gluLookAt). I know to update the vector to use:

lookat.x = radiuscos(phi)cos(theta);
lookat.y = radius
lookat.z = radius

But I can’t seem to compute a phi and theta that work correctly. I’m pretty new to opengl.

Why not just do the rotation and translation yourself instead of using gluLookAt?

Because t’s for a lab for a class and the professor said so.