find($sort_key = $table_primary_key(s), $offset = "0", $limit = "10000", $direction = "ASC", $search_string = '', $added_query = '', $added_query_type = 'AND')

If $sort_key is a postgresql keyword (like "order"), you need to put quotes around it. We don't put quotes around it by default b/c you could sort by - "order",date - or - "order" DESC, date ASC

Queries the database based on the currently set variables of the class. Class variables that aren't set are not used.

Returns results as an array of classes

Returns false if no records are founds

If $query_string is set, it'll split the query string (e.g. "term1 term2" or "term1, term2") and make sure each term is found at least once in a non-boolean field

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"

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;
$p->set_state("MO");
$results $p->find("name"$offset$results_per_page"ASC"$search_string);
$pagination $p->get_find_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]";

?>