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 = 27 ORDER BY a.createdon DESC LIMIT 0, 40MySQL server has gone away