How to unlock a locked passcode on iphone without deleting anything?

My friend mistakely put the passcode many times and locked it for me.

You have to go into your gmail account if applicable to unlock it. When you put in your passcode it should give you the option. Other than that you will have to reset your phone or take it to your cell provider to reset it for you if you don't know how to.