SELECT SQL_CALC_FOUND_ROWS a.adid, a.adtitle, a.cityid, ct.cityname, a.subcatid, a.price, UNIX_TIMESTAMP(a.createdon) AS timestamp FROM bazaro_ads a INNER JOIN bazaro_cities ct ON a.cityid = ct.cityid INNER JOIN bazaro_subcats scat ON a.subcatid = scat.subcatid WHERE 1 AND a.verified = '1' AND a.expireson >= NOW() AND a.paid <> '0' AND ct.countryid = 5 ORDER BY a.createdon DESC LIMIT 40, 40MySQL server has gone away