$date=date('Y-m-d');
$date2=date('Y-m-d',strtotime('-7day'));
$dbqr_item_logs=slcvar2("select max(view) as view,item from pt_item_logs where news='".$news."' AND ฟิลล์วันที่ between '$date' and' $date2' group by view desc,pt_item_logsid desc limit 0,10");
function newsRightSide($link_root,$page,$news,$username,$password,$signup) {
$rsnewstop10=slcvar3("select * from pt_news where news='".$news."'");
$rsbanner=slcvar3("select * from banner where name='".$page."'");
$arrbanner=explode(",",$rsbanner["banner"]);
echo '
<div style="float:left;width:295px;height:auto;margin-left:6px;">
<div style="float:left;">';mnBanner($link_root,$page,"10.png","index",$page,"right1",0,randBanner($page,$arrbanner[0]),4,300,250);echo '</div>
<div style="float:left;margin:10px 5px 10px 5px;padding-left:20px;">
';
ptLogin($link_root,$page,$username,$password,$signup);
echo '
</div>
<div style="float:left;border:1px solid #ccc;width:285px;padding:7px 5px 10px 5px;"><ul>
<li style="text-align:left;padding-left:5px;"><span style="font-size:11pt;"><strong>10 อันดับ';if($rsnewstop10["portal"]=="talk" || $rsnewstop10["portal"]=="picpost" || $rsnewstop10["portal"]=="clippost"){echo $rsnewstop10["name"];}else{if(slcvar1("select * from pt_news where news='".$news."' and name like '%ข่าว%'")) {echo $rsnewstop10["name"];} else {echo "ข่าว".$rsnewstop10["name"];}}echo 'ในรอบสัปดาห์</strong></span></li>
';
if(slcvar1("select * from pt_item_logs where news='".$news."'")) {
$dbqr_item_logs=slcvar2("select max(view) as view ,item from pt_item_logs where news='".$news."'group by view desc,pt_item_logsid desc limit 0,10");
$num_rows_item_logs=mysql_num_rows($dbqr_item_logs);
for($i=0;$i<$num_rows_item_logs;$i++) {
$rsitemlogs=mysql_fetch_array($dbqr_item_logs);
$rsitemtop10=slcvar3("select * from pt_item where item='".$rsitemlogs["item"]."'");
echo '
<li style="text-align:left;clear:both;padding:5px;">
<p style="float:left;width:26px;"><img src="'.$link_root.'images/'.$page.'/hot_'.($i+1).'.png" border="0" /></p>
<p style="float:left;padding-left:5px;width:240px;"><a href="'.$link_root.$page.'/view.php?g_it='.$rsitemtop10["item"].'">'.$rsitemtop10["name"].'</a></p>
</li>
';
}
} else {
echo '
<li style="text-align:left;clear:both;padding:5px;"><span style="color:#ff0000;">ยังไม่มี';if($rsnewstop10["portal"]=="talk" || $rsnewstop10["portal"]=="picpost" || $rsnewstop10["portal"]=="clippost"){echo $rsnewstop10["name"];}else{if(slcvar1("select * from pt_news where news='".$news."' and name like '%ข่าว%'")) {echo $rsnewstop10["name"];} else {echo "ข่าว".$rsnewstop10["name"];}}echo 'ในรอบสัปดาห์นี้ค่ะ!!</span></li>
';
}
echo '
</ul>
</div>
<div style="float:left;margin-top:10px;">';mnBanner($link_root,$page,"40.png","index",$page,"right2",1,randBanner($page,$arrbanner[1]),4,300,271);echo '</div>
<div style="float:left;margin-top:10px;">';mnBanner($link_root,$page,"22.png","index",$page,"right3",2,randBanner($page,$arrbanner[2]),4,300,250);echo '</div>
<div style="float:left;margin-top:10px;">';mnBanner($link_root,$page,"26.png","index",$page,"right4",3,randBanner($page,$arrbanner[3]),4,300,250);echo '</div>
</div>
';
}
Date :
2010-10-13 17:32:11
By :
porkdeng
No. 5
Guest
จาก No.4 ลองสลับตัวแปร $date ดู
$dbqr_item_logs=slcvar2("select max(view) as view,item from pt_item_logs where news='".$news."' AND ฟิลล์วันที่ between '$date2' and' $date' group by view desc,pt_item_logsid desc limit 0,10");
$date=date('Y-m-d');
$date2=date('Y-m-d',strtotime('-7day'));
$dbqr_item_logs=slcvar2("select max(view) as view,item,postdate from pt_item Left Join pt_item_logs ON pt_item.item=pt_item_logs.item where news='".$news."' AND postdate between '$date2' and' $date' group by view desc,pt_item_logsid desc limit 0,10");
แต่ทว่ามันก็ยังไม่ได้ มันขึ้น error แบบนี้ค่ะ
Warning: mysql_num_rows() expects parameter 1 to be resource, null given in /Applications/XAMPP/.........