Could have been the cord. There are many that can be found that are of very poor quality and may not work at all. Some will work only for data transfers, but do not have the capability to provide charging. Not sure where you bought the cord, but Amazon sells many and just by reading the reviews, you can see that they also sell many that don't work.
If you bought a cord from Apple, then all of them are capable of providing power, so you should check the connector on your device for lint or something blocking in the port.