Moved mysql connection outside of view