SELECT /*DISTINCT*/ class_ads . * , class_ads.id AS adid, DATE_FORMAT( class_ads.`date_added` , '%d.%m в %H:%i' ) AS date_nice, DATE_FORMAT( class_ads.`date_expires` , '%d.%m в %H:%i' ) AS date_expires_nice, UNIX_TIMESTAMP( class_ads.`date_added` ) AS `time_added` , (
class_ads.date_expires < '2019-08-19 20:07:29'
AND class_ads.date_expires != '0000-00-00 00:00:00'
AND class_ads.active =0
) AS expired, class_slugs.slug
FROM class_ads
INNER JOIN class_slugs ON class_ads.id = class_slugs.object_id
WHERE class_ads.active =1
AND class_slugs.`type` = 'listing'
ORDER BY `priority` DESC , date_added DESC
LIMIT 0 , 12
$str_index = "";
if($this->use_index) $str_index = " use index ({$this->use_index}) ";
$sql = "select distinct ".TABLE_ADS.".*$mlang_vars, ".TABLE_ADS.".id as adid, date_format(".TABLE_ADS.".`date_added`,'$date_format') as date_nice, date_format(".TABLE_ADS.".`date_expires`,'$date_format') as date_expires_nice, UNIX_TIMESTAMP(".TABLE_ADS.".`date_added`) as `time_added`, (".TABLE_ADS.".date_expires < '$timestamp' and ".TABLE_ADS.".date_expires!='0000-00-00 00:00:00' and ".TABLE_ADS.".active=0) as expired
$str_slugs
$q_vars
from ".TABLE_ADS." $str_index
$q_join $join_pictures $join_cat $join_users
$join_slugs
".$where.$where_slugs." ".$order_by." ".$order_way." ";
if($ads_per_page>0) $sql .= " limit ".$general_row.", ".$ads_per_page;
// echo $sql."<br/><br/>";
$arr = $db->fetchAssocList($sql);
EXPLAIN SELECT DISTINCT class_ads . * , class_ads.id AS adid, DATE_FORMAT( class_ads.`date_added` , '%d.%m в %H:%i' ) AS date_nice, DATE_FORMAT( class_ads.`date_expires` , '%d.%m в %H:%i' ) AS date_expires_nice, UNIX_TIMESTAMP( class_ads.`date_added` ) AS `time_added` , (
class_ads.date_expires < '2019-08-19 20:07:29'
AND class_ads.date_expires != '0000-00-00 00:00:00'
AND class_ads.active =0
) AS expired, class_slugs.slug
FROM class_ads
INNER JOIN class_slugs ON class_ads.id = class_slugs.object_id
WHERE class_ads.active =1
AND class_slugs.`type` = 'listing'
ORDER BY `priority` DESC , date_added DESC
LIMIT 0 , 12
$str_index = "";
if($this->use_index) $str_index = " use index ({$this->use_index}) ";
$sql = "select distinct ".TABLE_ADS.".*$mlang_vars, ".TABLE_ADS.".id as adid, date_format(".TABLE_ADS.".`date_added`,'$date_format') as date_nice, date_format(".TABLE_ADS.".`date_expires`,'$date_format') as date_expires_nice, UNIX_TIMESTAMP(".TABLE_ADS.".`date_added`) as `time_added`, (".TABLE_ADS.".date_expires < '$timestamp' and ".TABLE_ADS.".date_expires!='0000-00-00 00:00:00' and ".TABLE_ADS.".active=0) as expired
$str_slugs
$q_vars
from ".TABLE_ADS." $str_index
$q_join $join_pictures $join_cat $join_users
$join_slugs
".$where.$where_slugs." ".$order_by." ".$order_way." ";
if($ads_per_page>0) $sql .= " limit ".$general_row.", ".$ads_per_page;
<script type="text/javascript">
if(window.innerWidth < 600){ /*если нужно чтобы блок показывался, когда больше 600, то >601? */
(function(w, d, n, s, t) {
w[n] = w[n] || [];
w[n].push(function() {
Ya.Context.AdvManager.render({
blockId: "R-A-355220-28",
renderTo: "yandex_rtb_R-A-355220-28",
async: true
});
});
t = d.getElementsByTagName("script")[0];
s = d.createElement("script");
s.type = "text/javascript";
s.src = "//an.yandex.ru/system/context.js";
s.async = true;
t.parentNode.insertBefore(s, t);
})(this, this.document, "yandexContextAsyncCallbacks");
}
</script>
$str_index = "";
if($this->use_index) $str_index = " use index ({$this->use_index}) ";
$sql = "select distinct ".TABLE_ADS.".*$mlang_vars, ".TABLE_ADS.".id as adid, date_format(".TABLE_ADS.".`date_added`,'$date_format') as date_nice, date_format(".TABLE_ADS.".`date_expires`,'$date_format') as date_expires_nice, UNIX_TIMESTAMP(".TABLE_ADS.".`date_added`) as `time_added`, (".TABLE_ADS.".date_expires < '$timestamp' and ".TABLE_ADS.".date_expires!='0000-00-00 00:00:00' and ".TABLE_ADS.".active=0) as expired
$str_slugs
$q_vars
from ".TABLE_ADS." $str_index
$q_join $join_pictures $join_cat $join_users
$join_slugs
".$where.$where_slugs." ".$order_by." ".$order_way." ";
if($ads_per_page>0) $sql .= " limit ".$general_row.", ".$ads_per_page;
// echo $sql."<br/><br/>";
$arr = $db->fetchAssocList($sql);
//_print_r($arr);
$i=0;
$result=array();
$pictures=new pictures();
if($is_mobile) {
global $mobile_settings;
$nopic = $mobile_settings['mobile_nopic'];
$medNopic = $mobile_settings['mobile_nopic'];
} else {
$nopic=$ads_settings["nopic"];
$medNopic=$ads_settings["med_nopic"];
}
".TABLE_ADS.".id as adid,
$where="where explain ".TABLE_ADS.".active = 1".$where.$locations_str;
SELECT class_ads. * , class_ads.id AS adid,