It's most likely that the cable has a flaw or that you may need to perform a hard reset of the phone. Depending on the model, it will be the power and home button or the power and volume down (iPhone 7/7 plus). This will essentially reboot the phone and clear any issues normally. Also check the cable for any nicks or signs of it having been turned too much at the end with the lightning connector on it. I know that some cables I have gotten in the past and including Apple cables, having had issue from the kids having them plugged into the charger and moving about a lot. This coupled with turning the phone over and such, causes the charger cable to get bind at the lightning connector. This may not be the case, but it has happened to me on more than one occasion. Disregard if it's not an authorized apple cable. Hope this helps and hope you get it resolved. If all else fails, hit up a Best Buy or Apple Store as said above. Good day.