He has trouble getting hard!

So the last month or so we have had a hard time fhaving sex because he will either get soft while we were doing it or I've just won't get hard! I don't know what to do. It always makes me feel ensecure like he isn't attracted to me or that he isn't enjoying it! Then we end up fighting because he swears that it's not the case! I don't know what to do any advice?