Sometimes when I am stopped my car will shut off.Could it be the fuel pump? on 2005 Mazda RX-8

Rookie cbe0621eac06868b3efe0d8d1d3611e23c60d3114864ea2ec19a68cfbd3eebab
It will also shut off when i am driving. Sometimes it will take forever to start.
(1) Answer
Sorry that I am responding so late, but my car was doing this and it needed a new motor