As Lev mentioned, you have to be a class that finds spells, and you find them from defeating enemies, just like the pirate finds items after battle.
I'm sorry everyone's having so many problems saving data. I wonder if there could be some concurrency problems. I might turn on some debugging in the php and have it spit any database errors to the screen if that's where the problems lie.