SEX FAIL!!

so i'm a virgin, and me and my boyfriend tried having sex last night and again this morning. but everytime i would get him hard, before he could put it in he would lose his boner. and he was still kind of hard, but since i was so tight there's no way it could've gone in. any advice on what to do for next time?