rotate the camera around an object !!!??

hey guys, so i’m trying to have my camera rotate around an object using the mouse as a controller, i can’t find a way the change the camera pivot , i need it to stay focused on a target. I tried parenting it to an empty and rotating the empty, and that works ok when rotating around the z axis but i can’t figure out how to get the vertical rotation right.

edit: managed to fix this by aligning the y axis of the empty with the Y of the camera, and now it works