Probably a broken usb cable. I recently had the same problem. Phone still charges with the cable, but data doesn't work anymore.
Try a different cable from another phone or something, i guarantee it will work again.
Ps.
Your cable can be damaged even if it looks fine from the outside.