0

This is my pagination script:

<?php
/***********************************
 * PhpMyCoder Paginator            *
 * Created By PhpMyCoder           *
 * 2010 PhpMyCoder                 *
 * ------------------------------- *
 * You may use this code as long   *
 * as this notice stays intact and *
 * the proper credit is given to   *
 * the author.                     *
 ***********************************/
?> 
	<head>
    	<title> Pagination Test - Created By PhpMyCoder</title>
        <style type="text/css">
			#nav { font: normal 13px/14px Arial, Helvetica, sans-serif; margin: 2px 0; }
			#nav a { background: #EEE; border: 1px solid #DDD; color: #000080; padding: 1px 7px; text-decoration: none; }
			#nav strong { background: #000080; border: 1px solid #DDD; color: #FFF; font-weight: normal; padding: 1px 7px; }
			#nav span { background: #FFF; border: 1px solid #DDD; color: #999; padding: 1px 7px; }
		</style>
    </head>
    	<?php
ini_set ("display_errors", "1");
error_reporting(E_ALL);
			//Require the file that contains the required classes
			include("pmcPagination.php");
				
			//PhpMyCoder Paginator
			$paginator = new pmcPagination(20, "page");
			
			//Connect to the database
			mysql_connect("localhost","root","PASSWORD");
			//Select DB
			mysql_select_db("tvguide");

			//Select only results for today and future
$result = mysql_query("SELECT programme, channel, airdate, expiration, episode, setreminder FROM thementalistonair where expiration >= now() order by airdate;");

echo '<h1>#records: ', mysql_num_rows($result), "</h1>\n";
while($row = mysql_fetch_array($result))
{
				$paginator->add(new paginationData($row['programme'],
												   $row['channel'],
												   $row['airdate'],
												   $row['expiration'],
												   $row['episode'],
												   $row['setreminder']));
			}
		?>
        <?php
			//Show the paginated results
			$paginator->paginate ();
		?><? include("footer1.php"); ?>
        <?php
			//Show the navigation
			$paginator->navigation();						
		?>

I put in three records as test data, but only three displayed.
I have 4 records in my table, displaying events that occur on the following dates
(quoted from the airdate and expiration fields of my table here):

2010-06-03 12:55:00 2010-06-03 13:55:00
2010-06-04 12:55:00 2010-06-04 13:55:00
2010-06-05 18:55:00 2010-06-05 19:55:00
2010-06-06 19:00:00 2010-06-06 20:00:00

Unless I duplicate the first record, it does not show.

Has anyone else ever experienced this error and what should I do to fix it?

Thanks

Edited by whitestream6: n/a

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Monster Killer
0

I have not had this but it could be due to this:

where expiration >= now()

If the 4th record does not meet this then it wont be displayed. And because you duplicated the first, that meets the rule so its there twice.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.