addReply function connected to database