0) { while ( $row = mysql_fetch_array($QUERY) ) { $id_list_sub_cat[] = $row['id']; } } $QUERY = mysql_query($SQL_MENU) or die (); $rec_for_page = 10; $SQL_TOT_ARTICLES = " SELECT count(*) tot FROM ARTICLES WHERE visible=1 AND status='on' AND date<=now() AND"; if (!$la) { $SQL_TOT_ARTICLES .= " DATE_SUB(CURDATE(),INTERVAL ".$std_view_days." DAY) <= date AND "; } $SQL_TOT_ARTICLES .= " id_cat=".(int)$idcat; $QUERY = mysql_query($SQL_TOT_ARTICLES) or die (); $row = mysql_fetch_array($QUERY); $tot_articles = $row['tot']; $s = (int)$_GET['s']; $scat = $_GET['scat']; $f = (int)$_GET['f']; function getCatInfo($id) { $SQL_CAT1 = "SELECT id id_cat, name name_cat, header_image , father,bgcolor1, bgcolor2, style style_cat, description description_cat from CAT where id=".(int)$id; $QUERY_CAT1 = mysql_query($SQL_CAT1); $CAT1 = mysql_fetch_array($QUERY_CAT1); return $CAT1; } if ($tot_articles==0 && $TOT_MENU>0 && $scat!="n") { $INFOCAT = getCatInfo($id_list_sub_cat[0]); } else { $INFOCAT = getCatInfo($idcat); } $banner_cur_cat = $INFOCAT['id_cat']; $bn_728x90 = bannerRand("728x90",$banner_cur_cat,'archive'); $pippo = $bn_728x90['obj']; ?>