To diagnose the issue you'll need to check a few things. The first thing to check is the charger you're using. Is the LED lighting up on the charger? If so, what color does it give? Have you confirmed the charger works with another device? Have you tested a different charger on this device? If the problem persists even with a known good charger, then the next step would be to check the integrity of your charging port. Do the pins look burnt or damaged in anyway? Are there any obstructions in the charging port itself? If the charging port looks fine, you could try an SMC reset. If the issue persists after an SMC reset, then you'll need to open up the device and do some internal troubleshooting, like swapping out the battery or the MagSafe board. Good luck!