If your laptop charger seems broken, it's most likely because the battery will not charge. You plug in the cord, the lights come on, but the charging light doesn't change or blinks repeatedly. When you remove the power cord, the laptop shuts off instantly due to the depleted battery. There's more than one cause for this, and it's not always a broken charger.
Check the connection between the charger and the laptop. It should fit firmly in the DC jack without wiggling. If it is loose, use electrical tape to hold it in place so the charger can receive power. This is a temporary fix, however, because a faulty connection can create sparks and cause a fire or injury. A loose connection will just get worse over time, so have it sent to a DC jack specialist as soon as possible. Turn off the laptop and flip it upside down. Locate the latch that secures the battery and slide open. The battery should pop out; give it a tug if it doesn't. Apply a small amount of rubbing alcohol (Methylated Spirits)to the tip of a cotton swab and use it to clean the battery's connectors. Dirt can build up and interfere with the connection, giving the appearance of a broken charger. Let the alcohol dry completely and re-insert the battery. Slide the latch to secure it and plug in the power cord to test it. See if the laptop powers on with the charger only and battery removed. If it does, the battery is the likely culprit and should be replaced. If the charger is truly broken, the only thing to do is to replace it or the power cord attached to it. Look on the bottom and write down the part number. Call the laptop manufacturer for a replacement charger or search for the part number on eBay. If you purchase from anyone other than the original manufacturer, ask for genuine parts to reduce the possibility of problems. Troubleshoot Mag Safe adaptors http://support.apple.com/kb/ts1713