Unless you're buying them canned, mushrooms are the kind of item you purchase right before you use them. They don't last long. The best thing to do, in my experience, is put them in a brown paper bag in your fridge; the reason is because the bag "breathes" (ie: moisture can pass through the paper). Don't wash them until you're ready to cook them. As for when they rot, go by the expiration date on the container or even earlier if they're looking questionable.
Unpeeled garlic goes in a cool, dry place- not your refrigerator. Avoid moisture at all costs. Peeled garlic, however, is safe to refrigerate. Some people store it in oil, but due to the numerous bacterial infections that can result from such a method, I advise against it. Untouched, a bulb of garlic is good for about three months; if it's peeled then it's good for a week.