An old-fashioned doorknob has a small setscrew at the base, which secures it to the end of a spindle that runs through the door. When the knob comes off, it is usually because the setscrew is loose or lost; tighten or replace it. If the spindle is so worn that the screw will not seat, rotate the knob 1/4 turn and try a new spot. You may have to do this to the knob on the other end, too, to maintain tension.
Sometimes the knob itself screws onto the spindle, and these threads become worn. Try putting a wad of putty or modeling clay inside the knob and screwing the knob back on, or wrap the spindle with plastic tape. If these tricks fail, replace the spindle. Or, as a final alternative-say, to save an antique doorknob-position the knob on the spindle and drill all the way through the base. Then insert a bolt and cap it with a decorative nut.
Some spindles screw together in the middle. When the threads become worn, replace the whole spindle. New doorknobs
Modern doorknobs are part of the latch assembly, which includes a spring catch and perhaps a lock as well. Install these as you would a deadlock, following the manufacturer’s instructions.
Usually, one knob is attached to the spindle and to an escutcheon, or rose. The rose includes two stems that penetrate the latch mechanism; they are threaded inside to receive mounting screws, which secure the other knob.
Some assemblies have no stems; instead the mounting screws go into a lock cylinder connected to one knob.
Most problems can be solved by tightening the mounting screws. If no screws are visible, look for a spring catch under the knob. Depress it, remove the knob, and tighten the screws that are revealed.