php:

global $pagesize,$page;
$pagesize = 10;//分页改为10条一页
$offset or $offset = ($page-1)*$pagesize;
$tablelist1=$db->query("SELECT c.company,b.title,b.itemid,c.userid FROM `{$DT_PRE}company_brand` as l,`{$DT_PRE}company` as c,`{$DT_PRE}brand_13` as b where c.userid=l.company_id and l.brand_id=b.itemid and c.company like '%$gs%' and b.title like '%$pp%' ");
$total = $db->num_rows($tablelist1);//条数
$sqll="SELECT c.company,b.title,b.itemid,c.userid FROM `{$DT_PRE}company_brand` as l,`{$DT_PRE}company` as c,`{$DT_PRE}brand_13` as b where c.userid=l.company_id and l.brand_id=b.itemid and c.company like '%$gs%' and b.title like '%$pp%' LIMIT ".$offset.",".$pagesize;
$tablelist=$db->query($sqll);
$CAT['TAGS_pages_num'] = $total;//分页处理
$CAT['TAGS_pages'] = $pages = pages($total, $page, $pagesize);//分页处理

前台:

<?php
$page=1;//分页重置
?>

 

然后直接输出$pages