0) $gn_id = intval($_GET['id']); if($gn_id>0) $sql = "SELECT * FROM tbl_news_group WHERE gn_id = ".$gn_id; else $sql = "SELECT * FROM tbl_news_group WHERE at_id <> 2 ORDER BY gn_order DESC";; $result = mysql_query($sql) or die("Not query sql"); $r = array(); $r1 = array(); while($rows = mysql_fetch_array($result)) { $r[]=$rows; if($gn_id >0) $sql1 = "SELECT * FROM tbl_news WHERE gn_id = ".$rows['gn_id']." AND at_id <> 2 ORDER BY ne_id DESC LIMIT 0,10"; else $sql1 = "SELECT * FROM tbl_news WHERE gn_id = ".$rows['gn_id']." AND at_id <> 2 ORDER BY ne_id DESC LIMIT 0,3"; $result1 = mysql_query($sql1) or die("Not query sql1"); while($rows1 = mysql_fetch_array($result1)) { $r1[]=$rows1; } } #BANNER $sqlBanner = "SELECT * FROM tbl_banner WHERE ba_id = 1"; $rB = $db->Rows($sqlBanner); $smarty->assign('rB',$rB); #-------------------------------------------------------------------------- $smarty->assign("r",$r); $smarty->assign("r1",$r1); #-------------------------------------------------------------------------- $smarty->display($template_root.'news.tpl'); ?>