actually, the most effective technique is very simple... all you need is a 
query, the page number you want and the number of items on a page.First execute 
your query but don't fetch the resuts. Keep in mind is that executing a query 
takes a fraction of the time & resources it takes to fetch the result set and 
build an array - especially if it's a large result set. $qh = mysql_query($sql, 
[connection stuff]);All you want to fetch is the page of data you want to 
display, so you want to shift the result set's internal pointer to the right 
spot. The index you want will be (PageNumber -1) * 
numberOfItemsOnPage:mysql_data_seek($qh, $index); This is also very fast and 
will return false if the index is out of range.Now, you can do a fetch loop 
until you get a page's worth of rows or reach the end of the result set. No 
matter how big the result set is, you're always building a small array so it's 
pretty fast..If you'd like to display how many rows were returned, 
use mysql_num_rows($qh); This also uses the query handle and is also very 
fast.Since you can execute your query every time without a lot of overhead, it 
doesn't really matter how volatile the data is.While this example uses mysql, 
other engines have similar functions available too.
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to