php:space_album.php
//图片列表
$list = array();
$pinglun = array();
if($count) {
$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('pic')." WHERE $wheresql ORDER BY dateline DESC LIMIT $start,$perpage");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$value['pic'] = pic_get($value['filepath'], $value['thumb'], $value['remote']);
$list[] = $value;
$query2 = $_SGLOBAL['db']->query("SELECT * FROM ".tname('comment')." WHERE id='$value[picid]' ORDER BY dateline desc LIMIT $start,$perpage");
while ($value2 = $_SGLOBAL['db']->fetch_array($query2)) {
realname_set($value2['authorid'], $value2['author']);
$pinglun[] = $value2;
}
}
}
//分页
$multi = multi($count, $perpage, $page, "space.php?uid=$album[uid]&do=$do&id=$id");
--------------------------------
html:
<!--{loop $list $value}-->
显示图片
<!--{loop $pinglun $value}-->
图片对应评论
<!--{/loop}-->
<!--{/loop}-->
以上是我的代码,但是会调用所有的评论WHERE id='$value[picid]' 怎么无效?有待高手解决。 |