sometimes it happens to me too. what i do is blow on the charger connector end. ala nintendo. then wipe it with a tissue. then it works. could be that your there is dust residue in your connections.
lyca, what's the age of your Mac and/or battery? If it's less than a year old and less than 300 cycles, the battery should be at 80% of its original capacity minimum. If it's not charging anymore, Apple should replace it if you satisfy the first two conditions. If it's beyond 1 year old, then Apple may not offer a replacement even if you have AppleCare. Just wanted to share my case. It could be slightly off topic but I would like everyone to know that Apple can commit errors too. My original battery was 1.5 years old when it started showing problems. It was only at 100+ cycles and it was 2 weeks later when I found out that the battery pack swelled. I called up PMC to ask if AppleCare or the battery recall program would cover it. They said no, because the battery is over a year old. At that point, it would be difficult to tell if it was a factory defect or misuse. Not convinced, I called up Apple Singapore. The rep I talked to told me that it will be replaced, free of charge including labor since the swelling may have damaged other parts of my Mac. It was exlained to me later by another rep that by policy, these cases are really not covered by Apple. Unfortunately for them, the first rep I have spoken with made a commitment to replace it so they will honor that commitment. I guess I just got lucky.
when i transferred to another room, i used the apple provided extension cord to charge my mac but it wasnt charging. i removed the extension. still not charging. tried using another charging and it was charging. i figured that something was probably wrong with my charger. then i noticed that there was a compartment for a fuse on the plug. i swapped the fuses and it was charging again. but i cant get it to charge when im using the extension. ill buy new fuses and see what happens.