If i forgot my code for my iphone is there a way to unlock it without losing my data?

I had a friend change the code on my phone and i didn't like it so i changed it to something els. It was different then the first one that i had and now i have no idea what it is. I was wed surfing trying to find a way to get on my phone again but everything said that i would lose all my data. I was ok with losing apps and stuff, but i'm not gogint to lose my photos. My phoine is npot synced to my computer, and i need to find a way to unlock it. Please help me find a way or tell me if its even possible to do it without losing data.

Sorry but you can't. You need to do a factory reset which erases everything.