Either that or, since the card was loose (it should never be), there may be a physical problem with the SD port.
If the card is actually corrupted, there's not to much you can do easily. Take it out of the phone and put it into a USB adapter, so you can plug it into a PC. Then go to
PhotoRec Step By Step. If the PC can see that the card is inserted (even if it can't read it), PhotoRec may be able to recover any non-corrupted files on it. (But it can take days once you set it up and tell it to run, so don't expect results in an hour or two, unless it can't read the card at all.)
If the card can't be read, try to format it. (Yes, you'll lose everything on it.) If it can't be formatted, it's useless - unless it's a SanDisk card. They honor their warranties. Contact them at
SanDisk microSD Tech Support, upper right corner (live chat), and they may have more ideas. If not, they'll probably replace the card.
But if the SD port in the phone is bad or loose, it has to be replaced, or the same thing will happen again.