[reason],[subject] + 只好 + [verb phrase]
[reason],[subject] + 只得 + [verb phrase]
只好 says there was no other choice, so you settle for this one. It goes before the verb, after the subject, and it almost always follows a clause that gives the reason.
It often carries a sigh: this isn't what you wanted, but it's what's left.
只得 means the same and is written, at home in reports and news.
不得不 is close. It stresses being forced from outside; 只好 stresses that the other options have run out.
只好 is about choice. For "only" with a number or a thing, use 只.
It doesn't give advice either. "You'd better" is 最好.