Stationary bikes are a great way to get a low-impact cardio workout. People with bad knees and joints often do well on a stationary bike (vs. the treadmill).
The problem comes in when the bike is not adjusted properly to fit your body. So have a fitness professional at the gym help you adjust the bike or use this rule of thumb from WebMD: Make sure that when you’re sitting on the seat with the ball of your foot on the pedal, there is a very slight bend in your knee. If you’re too low, you’re not allowing the legs to go through a full range of motion, meaning you'll burn less calories.
Many people sit way too low. This means that their knees will flex too much as they pedal, putting too much pressure on the knee and result in soreness.
Fit's Tip: The stationary bike is a less intense calorie-burner than some of the other machines, so I wouldn't always only do cardio on the bike, but it is a good way to add to or diversify your workout routine.