$query = "SELECT DISTINCT TITLE, PID, TYPE, SUM(DAYCOUNT) AS tot, ROUND(SUM(DAYCOUNT)/(
SELECT SUM(DAYCOUNT) FROM REPORT_LIST_VIEW), 4) AS per
FROM REPORT_LIST_VIEW
WHERE DAYCOUNT > '0'
GROUP BY TITLE, PID, TYPE
ORDER BY TITLE ASC";
$res = db_query($query) // drupal 7;
I am using PHP and SQL (oracle) DB to fetch details. Can any one share the details to add a pager in my page to show only 10 items per page.
`function pager_array_splice($res, $limit = 9, $element = 0) {
global $pager_page_array, $pager_total, $pager_total_items;
$page = isset($_GET['page']) ? $_GET['page'] : '';
// Convert comma-separated $page to an array, used by other functions.
$pager_page_array = explode(',', $page);
// We calculate the total of pages as ceil(items / limit).
$pager_total_items[$element] = count($res);
$pager_total[$element] = ceil($pager_total_items[$element] / $limit);
$pager_page_array[$element] = max(0, min((int)$pager_page_array[$element], ((int)$pager_total[$element]) - 1));
return array_slice($res, $pager_page_array[$element] * $limit, $limit, TRUE);
}`
`$output = '';
$customArr = pager_array_splice($res, 100);
$output .= theme('views_mini_pager', array('quantity' => 100));
print $output;`
This how i tried for drupal method. But fails.