I have recently been looking at the Pager script in PEAR, and installed it to my Apache install.
This is my existing code for my script (which doesn't use PEAR'S Pager script, for now anyway):
<?PHP
//connect to mysql
//change user and password to your mySQL name and password
mysql_connect("localhost","root","PASSWORD");
//select which database you want to edit
mysql_select_db("housemdepisodes");
// Select only results for today and future
$result = mysql_query("SELECT * FROM `epdata` WHERE `expiration`
>=NOW() ORDER BY `expiration` ASC LIMIT 20");
while($r = mysql_fetch_array($result)) {
$programme = $r["programme"];
$channel = $r["channel"];
$airdate = strtotime($r['airdate']);
$expiration = strtotime($r['expiration']);
$episode = $r["episode"];
$setreminder = $r["setreminder"];
$now = time();
if(date('Y-m-d') == date('Y-m-d', $airdate)) {
// Same date, show only time
$dateFormat = 'g:ia';
} elseif(date('Y') == date('Y', $airdate)) {
// Same year, show date without year
$dateFormat = 'F jS - g:ia';
} else {
// Other cases, show full date
$dateFormat = 'F jS, Y - g:ia';
}
$airdateFormatted = date($dateFormat, $airdate);
echo "<tr><td><b>$programme</b></td><td>showing on $channel</td>";
echo "<td>$airdateFormatted</td><td>$episode</td><td>$setreminder</td></tr>";
}
?>
However, I'm trying to get the database to work with it, but am not sure how to - there's not much documentation about actually working with Pager and databases.
http://pear.php.net/manual/en/package.html.pager.intro.php showed how to do it with arrays, but I'm trying to do it with my existing codebase, has anyone tried this and if so what's the best way to use it?