Look inside of your tower, you will have a few different cords connecting to your DVD/CD drive.
It should either have a 4 pin Molex connector and an IDE or a Sata connector and power.
The IDE cable looks like this:
The Molex connector looks like this:
IDE is an older tech that uses a 4 pin molex to connect it.
Now, if you have something that looks like this:
It uses Sata, and the power cable looks like it as well, it's just longer.
To make sure the DVD drive you're working will work with the current DVD/CD's you have, just look on the front of the CD you are going to use, in truth it usually should work with anything. It's even RW so you can re-write data to RW CD/DVD types.
Pretty much, just make sure that it uses the same power type and data connector as your current one. Power type being the 4pin molex or the Sata power plug. Data type being the IDE cable or the Sata cable.
If it matches, it will work :) I hope this helps.