<? $cnum=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsclass where is_zt=0"); $csql=$empire->query("select classid,classname from {$dbtbpre}enewsclass where is_zt=0 order by myorder,classid"); $ci=0; while($ccr=$empire->fetch($csql)){ $ci+=1; $cll='';
$inclassurl=ClassUrl($ccr[classid]); ?> <h2 class="fl"><?=$ccr[classname]?></h2> <a href="<?=$inclassurl?>" class="fre">» 更多</a> <ul>
<? $fgbsql=$empire->query("select * from {$dbtbpre}ecms_bookname where isgood=2 and classid=$ccr[classid] order by id desc limit 4"); while($tjr=$empire->fetch($fgbsql)){ $wbi=$empire->fetch1("select wid from {$dbtbpre}ecms_bookname_index where id=$tjr[id] limit 1"); ?>
<li class="ell"> <div class="coem"> <div><a href="<?=$tjr[titleurl]?>"><img src="<?=$tjr[titlepic]?>" alt="<?=$tjr[title]?>"></a></div> <p class="title"><a href="<?=$tjr[titleurl]?>" title="<?=$tjr[title]?>"><span class="eo"></span><?=$tjr[title]?></a></p> <div class="mary"><?=esub($tjr[smalltext],110)?></div> <p class="mrfix"> <span class="fn" title="推荐人数"><?=$tjr[diggtop]?></span> <span class="frm" title="浏览次数"><?=$tjr[onclick]?></span> <span class="fly">by <a href="#" class="shrd "><?=GetWname($wbi[wid])?></a></span> </p> </div></li>
<? } ?> </ul> <? } ?> --------------------------------------------------------------------------- [求助]这个SQL要怎么改才能按热门调用啊? <? $fgbsql=$empire->query("select * from {$dbtbpre}ecms_bookname where isgood=2 and classid=$ccr[classid] order by id desc limit 4"); while($tjr=$empire->fetch($fgbsql)){ $wbi=$empire->fetch1("select wid from {$dbtbpre}ecms_bookname_index where id=$tjr[id] limit 1"); ?> 改成这样不成啊:
$fgbsql=$empire->query("select * from {$dbtbpre}ecms_bookname where checked=1 and classid=$ccr[classid] order by onclick desc limit 4"); ------------------------------------------------------------------------- 上面整段是列出表里所有栏目,显示每个栏目4个推荐,如果我需要显示5个栏目的热门信息或显示最热门的5个栏目的信息(这里是2种方式)
|