Depending on how old it is, the DVD-ROM might be dying. Just check the power cable and the PATA/SATA cable are well connected, especially the second one as it has a higher tendency to come loose if the cable is stretched.
Or else take it out, try it out on a different machine. If still not working it's dead. Also check from BIOS if it can recognize your DVD drive.