为什么每页显示数量不一样
。。。。。。省略
$sql = "SELECT ck.chuku_id,ck.status,ck.danhao,ck.type,ck.sq_time,ck.bl_time,sq_user.real_name as sq_realname,bl_user.real_name as bl_realname FROM " .
$fdyu->table('oa_chuku') . " as ck left join " .
$fdyu->table('oa_chuku_huopin') . " as ck_hp on ck.chuku_id=ck_hp.chuku_id left join " .
$fdyu->table('oa_huopin') . " as hp on ck_hp.huopin_id=hp.huopin_id left join " .
$fdyu->table('users') . " as sq_user on ck.chuku_user_id=sq_user.user_id left join " .
$fdyu->table('users') . " as bl_user on ck.jingban_user_id=bl_user.user_id" .
$sql_where . $sql_qx;
。。。。。。。省略
回复讨论(解决方案)
这样基本上看不出什么吧,把分页的罗辑也贴出来看看呢.
$sql_where = ' where ck.school_id=' . $school_id;
if($bl_time_start != '')
{
$sql_where .= " and ck.bl_time>=" . gmstr2time($bl_time_start);
}
if($bl_time_end != '')
{
$sql_where .= " and ck.bl_time }
if($danhao != '')
{
$sql_where .= " and ck.danhao like '%" . mysql_like_quote($danhao) . "%'";
}
if($type != 0)
{
$sql_where .= " and ck.type=" . $type;
}
if($banzhuren_id != 0)
{
$sql_where .= " and ck.chuku_user_id=" . $banzhuren_id;
}
if($name != '')
{
$sql_where .= " and hp.name like '%" . mysql_like_quote($name) . "%'";
}
//判断是否有权限,如果没有则用户只能查看自己的入库单
if (strpos($_SESSION['action_list'],'oa_churuku_list') === false && strpos($_SESSION['action_list'], 'all') === false){
$sql_qx=" and (ck.chuku_user_id=".$_SESSION['userid']." or ck.jingban_user_id=".$_SESSION['userid']." or ck.check_user_id=".$_SESSION['userid'].") order by ck.chuku_id desc";
}else{
$sql_qx=" order by ck.chuku_id desc";
}
$sql = "SELECT ck.chuku_id,ck.status,ck.danhao,ck.type,ck.sq_time,ck.bl_time,sq_user.real_name as sq_realname,bl_user.real_name as bl_realname FROM " .
$fdyu->table('oa_chuku') . " as ck left join " .
$fdyu->table('oa_chuku_huopin') . " as ck_hp on ck.chuku_id=ck_hp.chuku_id left join " .
$fdyu->table('oa_huopin') . " as hp on ck_hp.huopin_id=hp.huopin_id left join " .
$fdyu->table('users') . " as sq_user on ck.chuku_user_id=sq_user.user_id left join " .
$fdyu->table('users') . " as bl_user on ck.jingban_user_id=bl_user.user_id" .
$sql_where . $sql_qx;
$res = $db->selectLimit($sql, $size, ($page-1) * $size);
$arr = array();
if ($res)
{
while ($row = $db->fetchRow($res))
{
.......省略
}
}
$page = !empty($_REQUEST['p']) && intval($_REQUEST['p']) > 0 ? intval($_REQUEST['p']) : 1;
$size = 10;
$count = get_chuku_count($school_id,$bl_time_start,$bl_time_end,$danhao,$type,$banzhuren_id,$name);
$pages = ($count > 0) ? ceil($count / $size) : 1;
$smarty->assign('count', $count); //记录总数
$smarty->assign('pages', $pages); //总页数
$smarty->assign('chuku_list', get_chuku_list($school_id,$bl_time_start,$bl_time_end,$danhao,$type,$banzhuren_id,$name,$page,$size));
$smarty->assign('pagenavi', get_pagenavi($page,$pages,5));
其中,get_chuku_list()这个函数就是我发的那些代码
上一篇: php里面 button 怎么传值?
下一篇: php生成随机颜色方法汇总_php实例
推荐阅读
-
电脑硬盘在系统中显示容量与实际容量为什么不一样
-
同样的代码,在DMcs6和VS2010中显示不一样,这是为什么?_html/css_WEB-ITnose
-
为什么每页显示数量不一样
-
同样的代码,在DMcs6和VS2010中显示不一样,这是为什么?_html/css_WEB-ITnose
-
在
- 标签内设置list-style-type:disc样式后,为什么在IE11和火狐浏览器显示效果不一样?如何使ie11显示成火狐的样子?_html/css_WEB-ITnose
-
为什么同样的源代码在localhost上显示的效果和源网站上效果不一样?_html/css_WEB-ITnose
-
电脑硬盘在系统中显示容量与实际容量为什么不一样
-
求各位帮忙看看为什么下面这段代码在IE和火狐上面显示的不一样呢?快急死了!!?_html/css_WEB-ITnose
-
求各位帮忙看看为什么下面这段代码在IE和火狐上面显示的不一样呢?快急死了!!?_html/css_WEB-ITnose
-
学习spirngmvc 和 使用 pager-taglib的一点小例子(包含 跳转页 及 每页显示数量控制) pager-taglibspringmvc分页插件