Hi kourtney267,
Thank you for participating in the Apple Support Communities. We understand your iPhone won't charge and you're seeing a message about an Unknown Part. It sounds like the battery may need to be replaced. This article explains the reasons you may see the message about an "Unknown Part": About genuine iPhone batteries - Apple Support.
"An Unknown Part message will appear if the battery installation is incomplete or if the battery:
- Was replaced with a nongenuine battery
- Was already used or installed in another iPhone
- Isn't functioning as expected"
This article has more information about replacing the battery if needed: iPhone Battery Repair & Replacement - Apple Support.
We hope this helps.
Take care.