Added MySQL update for history