Bob Harper, the fitness guru who was a trainer on and later the host of weight-loss competition The Biggest Loser, suffered a heart attack two weeks ago, according to TMZ.

Harper, 51, was working out at a gym in New York City when he collapsed. A doctor who also happened to be in the gym performed CPR and even used a defibrillator to keep Harper alive. He was taken to a hospital, where he was unconscious for two days.

Harper spent eight days before being released. For now, doctors are limiting his exercise regimen to walking.

Bob HarperBob Harper

Harper blames genetics for the heart attack, since his mother died from a heart attack. It certainly didn't happen because he's out of shape.

Harper's fans wished him well on social media.