Why is the number displayed on each page different? originally, the number displayed on each page is set to 10, but with some red code added, it will be messy. some pages display 2 records, some pages show 3 records, some pages show 4 records ...... The code is normal without the red part.
...... Omitted
$ 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;
....... Omitted
Reply to discussion (solution)
In this case, I can hardly see anything. I can also paste the pagination Luogic to see it.
$ 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 <=". gmstr2time ($ bl_time_end );
}
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). "% '";
}
// Determine whether you have the permission. if not, you can only view your own warehouse receiving ticket.
If (strpos ($ _ SESSION ['action _ list'], 'oa _ chiluku_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 ))
{
... Omitted
}
}
$ 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); // The total number of records.
$ Smarty-> assign ('Pages ', $ pages); // The total number of 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 ));
Specifically, the get_chuku_list () function is the code I sent.