This is my script for pagination (from someone else's one I downloaded) - customised to my localhost requirements:
http://pastebin.com/f7c5a4a90 (linked here to save re-posting it, it's two scripts actually, PmcPagination.php, and the page displayed on, display.php)
It works to the extent that it shows all events - but the dates do not correspond to those stored in the database, and as such are all listed as the following:
Event 1 on January 1st, 1970 - 1:00am "Family Event" Set Reminder
Event 2 on January 1st, 1970 - 1:00am "Historical Event" Set Reminder ...
and so on, for the next 20, 30, 40 records.
What should I do to fix this date/time error in the code? It's rendering OK ... for now but the date/time thing is proving tricky to fix.
Research on Google and various PHP sites did not help, so where has this gone wrong? (The code isn't my own, but an adapted version of someone else's!)
This was my earlier code for limiting records:
<?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("events");
// Select only results for today and future
$result = mysql_query("SELECT * FROM `eventup1` WHERE `expiration` >=NOW() ORDER BY `airdate` ASC LIMIT 20 OFFSET 10");
while($r = mysql_fetch_array($result)) {
$event = $r["event"];
$venue = $r["venue"];
$eventdate = strtotime($r['eventdate']);
$expiration = strtotime($r['expiration']);
$eventactive = $r["eventactive"];
$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';
}
$eventdate = date($dateFormat, $airdate);
echo "<tr><td><b>$event</b></td><td>showing on $venue</td>";
echo "<td>$eventdate</td><td>$eventactive</td><td>$setreminder</td></tr>";
}
?>
I get the error in the PmcPagination script but not this one... but that's because I am not sure how to paginate the older script I made.
How could I get the above script to paginate, in the style of this URL: http://library.digiguide.com/lib/programmenextshowing/Police%2C+Camera%2C+Action!-12578 (notice how the pagination is below the footer).
Any help is appreciated, thanks!