get_pagination($url, $offset, $limit, $style, $query_string = '', $number_of_middle_pages = 0, $link_style = null, $added_query = '', $added_query_type = 'AND')

Works with the get_all_array and get_all_class functions to return proper pagination prev and next links based on current offset

returns array(
    "total"=> (integer) total number of records
    "first"=> (integer) first records displayed
    "last"=> (integer) last_record displayed
    "p_link"=> "<a href=$url&offset=$correct_offset style='$style'>Prev X",
    "n_link"=> "<a href=$url&offset=$correct_offset style='$style'>Next X")
    with an optional "middle_links"=> "...whole bunch of links..."

If $query_string is set, it'll use the same search algorithm from get_all_array and get_all_class to determine the correct number of results.

If $link_style = '2arrow' it will turn p_link into "<< Prev X" and n_link into "Next X >>"

If $added_query is set, it will add to the query "SELECT * FROM table WHERE $added_query" If there is already a WHERE in the query it will work like "SELECT * FROM table WHERE () $added_query_type $added_query"

If $url end in "=", the "offset" variable will be the last element in the $url that is being passed in, otherwise, "&offset=X" will be added to the $url for the pagination variables

SEARCHES DO NOT SEARCH "_LOOKUP" VARIABLES

Example:

example.php
<?php
include("lib.php");
load("person");

$results_per_page 10;
$search_string $_GET["search_string"];
$uss urlencode($search_string);
if (!
$offset = (int) $_GET["offset"])   $offset 0;

$p = new person;
$results $p->get_all_class("name"$offset$results_per_page"ASC"$search_string);
$pagination $p->get_pagination("index.php?search_string=$uss"$offset$results_per_page""$search_string3"2arrow");

for(
$i 0$i $results_per_page$i++)
{
        if (!
$results[$i])
                break;
        
$r $results[$i];
        echo 
"Person: ".($i+$offset+1).": $r->name<br>";
}

if (
$pagination["p_link"] || $pagination["middle_links"] || $pagination["n_link"])
echo 
"<br>$pagination[p_link] &nbsp; $pagination[n_link] &nbsp; $pagination[middle_links]";

?>