Hello and welcome to JustAnswer!
Do you know all P code numbers that are setting?
Which engine do you have?
Diagnosing the problem is going to require knowing what codes are set. If you don't know the codes that are setting then you can have them read at most parts stores for free. If the problem has happened since the last time the codes were cleared or battery was disconnected then the codes will still be stored. If you can have the codes read and come back and post them here I'll be able to tell you more about what is going on with it.