I went to replace an old toilet out in the garage and the flange cracked. It and the pipe are black plastic (PVC?) and the flange appears to be glued on. Whoever did this the first time did not mount the flange to the concrete floor, but the pipe does feel very sturdy with no wiggling. I'm guessing the right approach is to cut this flange out/off and glue another one on, or perhaps use some sort of a compression fit one? Not sure how to deal with the lack of usable floor to firmly mount to. Perhaps ignore it since it has worked this way for over 10 years...
You need to find yourself a "Repair Flange" or "Flange Repair Ring".:
Images from Lowes
It fits over your existing broken flange and is fixed to the floor by using as many of the mounting holes as you can - preferably at least 4 IMO.