Your code makes no sense. You keep changing variable names and using ones that don't exist.
I just gave an example that actually I'm using for a banking system, everyday at a specific hour it calculates the rates for all registered players and I just want to know a way to optimize it..