Is the screw stripped? Take some toothpicks, glue them in the hole, let dry. Then screw the screw back into the hole and it should stay.
An epoxy filler can also be used.
Wood filler or Bondo will also work. but the toothpicks would be the easiest solution if the hole is not too big.
If the hole has disintegrated too large to support the screw, you can cut a wooden dowel to glue into the hole, and then drill a smaller hole to re-insert your leg.
If the screw is actually broken, you can replace it at a hardware store. Take the screw with you to the store, look for single screws or small packages and match the old with the new. Then proceed to fill the old hole as described by others, let that dry then use the new screw in it's place. Wishing you the best.