一个关于php分页的问题,请高手指教!!
我想尝试给DISCUZ的个人空间风格进行分页,新增加了一个home_theme的数据表,里面有3个字段,分别是id,themename,dir。PHP部分的代码我是这么写...
我想尝试给DISCUZ的个人空间风格进行分页,新增加了一个home_theme的数据表,里面有3个字段,分别是id,themename,dir。
PHP部分的代码我是这么写的:
$perpage = 20;
$curpage = empty ( $_GET['page'] ) ? 1 : intval ( $_GET['page'] );
$start = ($curpage-1)*$perpage;
$mpurl = "home.php?mod=space&diy=yes&op=style";
$count = $_SGLOBAL['db']->result($_SGLOBAL['db']->query("SELECT COUNT(id) FROM ".tname('home_theme')));
//$stylelist
$stylelist = array();
if ($count) {
$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('home_theme')." ORDER BY id DESC LIMIT $start,$perpage");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$stylelist[] = $value;
}
}
$multi = multi($count,$perpage,$curpage,$mpurl);
然后HTML部分是这么写的:
<!--{loop $stylelist $key $value}-->
<li style="margin-right:3px; margin-left:2px;"><a href="javascript:;" onclick="spaceDiy.changeStyle('$value[dir]');this.blur();return false;"><img src="{STATICURL}$value['dir']/preview.jpg" style="margin-bottom:8px;" />$value['themename']</a></li>
<!--{/loop}-->
<div>$multi</div>
运行时,提示错误:
Call to a member function result() on a non-object
请高手指点一下,哪里有问题?谢谢!!!!!! 展开
PHP部分的代码我是这么写的:
$perpage = 20;
$curpage = empty ( $_GET['page'] ) ? 1 : intval ( $_GET['page'] );
$start = ($curpage-1)*$perpage;
$mpurl = "home.php?mod=space&diy=yes&op=style";
$count = $_SGLOBAL['db']->result($_SGLOBAL['db']->query("SELECT COUNT(id) FROM ".tname('home_theme')));
//$stylelist
$stylelist = array();
if ($count) {
$query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('home_theme')." ORDER BY id DESC LIMIT $start,$perpage");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
$stylelist[] = $value;
}
}
$multi = multi($count,$perpage,$curpage,$mpurl);
然后HTML部分是这么写的:
<!--{loop $stylelist $key $value}-->
<li style="margin-right:3px; margin-left:2px;"><a href="javascript:;" onclick="spaceDiy.changeStyle('$value[dir]');this.blur();return false;"><img src="{STATICURL}$value['dir']/preview.jpg" style="margin-bottom:8px;" />$value['themename']</a></li>
<!--{/loop}-->
<div>$multi</div>
运行时,提示错误:
Call to a member function result() on a non-object
请高手指点一下,哪里有问题?谢谢!!!!!! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询