The query is sound. You can issue that same query in phpmyadmin in your hosting control panel and see if will return 37 results. No issue with that query. MYSQL HAS GONE AWAY means your mysql has shut down. As to why mysql has shut down I can not say maybe your host and server logs would have more info to assist in regards to that.