added code for updating and reading from MySQL database.