How to fix this about myself?

So I was in a slight relationship for the first time during last summer. I did things I never would’ve expected. I went kind of crazy. I said the most off the wall things when I felt he was trying to play me and I was constantly asking for reassurance like I was being crazy. How do I never let that happen again? It’s like a person I never even met before. Mind you it was also losing my virginity during this relationship but i don’t want anyone else to experience this. Not me not anybody. Is it a mental issue? Attachment issue? What was it I want to work on it? I know I coudl ask a therapist or something but I’m in college broke and really looking for affordable advice
How to fix this about myself?
Post Opinion