The failure of sockets on laptops is one of the largest causes of failure, particularly on cheaper models.
Due to the way they're attached to the motherboard, sockets can frequently come loose, causing major problems with the usability of your laptop. There's there's no need to throw your computer out though, because we can fix this.
A common mistake people make is assuming that intermittent power (where the computer sometimes shows "battery" even when the power supply is connected) is due to a faulty power supply. In fact, this is often due to a faulty power socket. If mains power only seems to come on when you hold the plug at a particular angle or have it pushed right in, then it's probably a faulty power socket.