Simple lesson. If you lock your phone, keep the code or you will be locked out. You may be able to have it reset by the service provider. I don't know what this entails but it is the only option if you don't remember your code.
My grandaughter forgot the code on her Samsung after changing the code from the default last four numbers of the phone number. We spent hours using every combination of of the couple numbers she could remember and finally got into the phone. I removed the lock after this and instructed her not to touch it in the future.