Well, the easiest way it to use the WHERE, LIMIT and SORT features in mysql,
since you're limiting rows returned based on a date field you can do
//// for yesterday
SELECT
FROM table
WHERE DATE(mydatefield) = DATE_SUB( CURDATE( ) , INTERVAL 1
DAY)
/// for a week
SELECT
FROM table
WHERE DATE(mydatefield) = DATE_SUB( CURDATE( ) , INTERVAL 1
WEEK)
/// for all
SELECT * FROM table
to work the next/back and interval buttons you have to do a little bit of math
the problem is if you do
SELECT * from foo LIMIT 50, even if there are 500 rows that match, a mysql_num_rows($query) would return 50, so you couldnt get a count or rows
the easiest but least practical way of doing this is to run 1 query that returns all the rows, and limit the number of rows displayed in the PHP
so if you have something like
$query=mysql_query("SELECT * from foo WHERE DATE(mydate) = DATE_SUB(CURDATE(), INTERVAL 1 WEEK) ");
lets say that returned 403 rows, which you want to display 50 at a time. Set default limit variable and do the math to dvide them into pages and display accordingly.
$results=mysql_num_rows($query);
$increments=50;
if (!isset($GET["show"])) $display=0;
else $display=$GET["show"];
$pages=ceil($results/ $increments); // that will give you the least number of pages you need to display to display them all
so on your links for pages you do href="page.php?show=".($page * $increment);
so when do iterate through your rows, you simply show only rows starting at $display to $display + $increment;