Finish mysql code and update MER