Ejemplo n.º 1
0
function pager_display($id, $query, $count_query, $count_field, $func)
{
    global $pager;
    if (is_numeric($count_query)) {
        $pager[$id]['count'] = $count_query;
    } else {
        $count = mysqli_fetch_array(db_query($count_query));
        $pager[$id]['count'] = $count[$count_field];
    }
    $pager[$id]['start'] = p_int('start' . pager_suffix($id), 0);
    $pager[$id]['stop'] = $pager[$id]['start'] + $pager[$id]['items_per_page'];
    $limit = ' LIMIT ' . $pager[$id]['start'] . ', ' . ($pager[$id]['stop'] - $pager[$id]['start']);
    $result = db_query($query . $limit);
    while ($row = mysqli_fetch_array($result)) {
        $func($row);
    }
    pager_pagelinks($id);
}
Ejemplo n.º 2
0
<?php

mod("pager");
mod("form");
$gp = pager_init(66);
$searchform = form_create('Search', 'inline', null, 'get');
form_add_param($searchform, 'Value', 'search', 'string', '', 100, 12);
$search = p_string('search');
$basedon = p_int('basedon', 0);
$sort = p_string('sort', 1);
$date = p_string('date', empty($search) ? 1 : 4);
if (isset($_GET['deleted'])) {
    $where = ' WHERE deleted=1 ';
} else {
    if ($basedon) {
        $where = ' WHERE basedon="' . $basedon . '" ';
    } else {
        if (!empty($_GET["search"])) {
            $where = ' WHERE deleted=0 AND MATCH(title) AGAINST("%' . e_mysql($search) . '%") ';
        } else {
            $where = ' WHERE deleted=0 ';
        }
    }
}
switch ($sort) {
    case 2:
        $order = "accesscount DESC";
        break;
    case 4:
        $order = "RAND()";
        break;