added mysql functionality to messages