An optical mouse works based on imaging principle so we have the freedom of accessing even in a 3D way. If your Optical mouse is not moving the cursor side wise, I would suggest you to look for the exact Mouse driver and install it. Usually on a Windows XP machine they work as plug and play.
If the Driver is working fine, you must look for the Windows or OS compatibility. The WDDM compatibility can also cause this to happen.
Else you have to replace the mouse.