100k = 100k records = 200 meg hehe > a sample from my db class, i had to store the total in a session as > calling the total on every page on a large database was painful doing > count(*) or even SQL_CALC_FOUND_ROWS, on a small database u just cant > tell but on a database of 100k + it was painful to load each page ;) > > function page_query($per_page, $query, $page, $session_var, $debug = > null, $start_session = null) { > if ($start_session) session_start(); > if(!$page) { > $this->page = 1; > $this->start = 0; > } else { > $this->page = $page; > $this->start = ($this->page - 1) * $per_page; > } > > if ((!$page && !$_SESSION[''.$session_var.'']) || (! > $_SESSION[''.$session_var.''])) { > $query = preg_replace("/SELECT|select/","\\0 > SQL_CALC_FOUND_ROWS",$query); > $query = "$query LIMIT $this->start, $per_page"; > $result = $this->query($query); > if ($debug) $this->debug(); > $row = $this->getOne("SELECT FOUND_ROWS() as > total_rows"); > $_SESSION[''.$session_var.''] = $row['total_rows']; > $this->total = $_SESSION[''.$session_var.'']; > } else { > $query = "$query LIMIT $this->start, $per_page"; > $result = $this->query($query); > if ($debug) $this->debug(); > $this->total = $_SESSION[''.$session_var.'']; > } > $this->pages = ceil($this->total / $per_page); > return $result; > } > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php