高手支招呀~~急!while($value=$db->fetch_array($query)){
if($i==$perpage){
$i==1;
}else{
$i++;
$srcfile = 'attachment/'.$value['attachment'];
$dstfile = 'image/tmp/thumb_'.$i.'.jpg';
$value['picurl'] = thumb($srcfile,$dstfile,100,100,1);
$threadlist[]=$value;
}上面是单页面显示数据$perpage= 10;
读取帖子的附件图片为主题的导读图片并处理为100×100的缩略图显示;
现在问题来了,分页数据是正确显示的,但点击thread.php?page=2 以后的主题导读图片都是第一页的图片!?请问如何解决 ?
if($i==$perpage){
$i==1;
}else{
$i++;
$srcfile = 'attachment/'.$value['attachment'];
$dstfile = 'image/tmp/thumb_'.$i.'.jpg';
$value['picurl'] = thumb($srcfile,$dstfile,100,100,1);
$threadlist[]=$value;
}上面是单页面显示数据$perpage= 10;
读取帖子的附件图片为主题的导读图片并处理为100×100的缩略图显示;
现在问题来了,分页数据是正确显示的,但点击thread.php?page=2 以后的主题导读图片都是第一页的图片!?请问如何解决 ?
错误就有可能出在你的sql limit不正确
}else{
接受参数不对
}
$threadlist = array();
$perpage =10;
$page = empty($_GET['page'])?1:intval($_GET['page']);
if($page<1) $page=1;
$star=$perpage*($page-1);
$mpurl = htmlspecialchars($_SERVER['PHP_SELF']);
$count = $db->result($db->query("SELECT COUNT(*) FROM {$tablepre}attachments WHERE filetype IN ('image/pjpeg','image/gif')"));
if($count){
$query = $db->query("SELECT attach.aid, attach.attachment, t.tid, t.fid, t.dateline, p.message, t.author, t.subject,f.name,p.authorid FROM {$tablepre}attachments attach LEFT JOIN {$tablepre}threads t ON t.tid=attach.tid LEFT JOIN {$tablepre}posts p on p.tid=attach.tid LEFT JOIN {$tablepre}forums f on f.fid=t.fid WHERE attach.readperm='0' AND filetype IN ('image/pjpeg','image/gif') GROUP BY attach.tid ORDER BY t.dateline DESC LIMIT $star,$perpage");
while ($value = $db->fetch_array($query)) {
/*thumb*/
if($i==2){
$i=0;
}else{
$i++;
$imgl = 'attachments/'.$value['attachment'];
$dstfile = 'image/tmp/list_'.$i.'.jpg';
$value['photo_picurl']=miniimg($imgl,$dstfile,100,100,1);
}
$threadlist[] = $value;
}
}
$multipage = multi($count, $perpage, $page, $mpurl);