$pages = ''; $pagesize = 2; $offset = ($page-1)*$pagesize; $rr = $db->get_one("SELECT COUNT(*) AS num FROM {$DT_PRE}photo_12 WHERE status=3"); $items = $rr['num']; $pages = mobile_pages($items, $page, $pagesize); $result = $db->query("SELECT * FROM {$DT_PRE}photo_12 WHERE status=3 LIMIT {$offset},{$pagesize}");