store query information to mysql