Invalid query: 2013: Lost connection to MySQL server during query