Unable to connect phone to pc. Phone charges only
First of all, start with easy-to-solve debugging:

Have you unlocked your phone while trying to connect to PC or did you connect with the screensaver showing?
After unlocking, you have a tab (in most of the phones its on top) that you can show by sliding down. There, you have a notification about the connection. Have you clicked it and set it to file transfer instead of just charging?
Try changing the USB cable.

Note: I know this could be answered by commenting the question but I haven't got enough reputation in this website.