You are reporting about two different unrelated things.
If the battery cable disconnected, you need to connect it again, or replace the cable if it is defective.
It's hard to imagine forgetting your Passcode, since you would be unlocking the phone multiple times each day using the Passcode.
If you really have forgotten your Passcode and have tried to enter it multiple times and failed, then the iPhone screen will display a message of "Unavailable".
Or maybe you are saying that you forgot your Apple ID Account Password?
In that case, the message on the iPhone's screen will display "Activation Locked".
Can you provide more details to help us at least get you started down the right path?