views:

68

answers:

1

This is my pagination script which extracts info for my TV guide project that I am working on. Currently I've been experimenting with different PHP/MySQL before it becomes a production site.

This is my current script:

<?php 
include("pmcPagination.php");                   
$paginator = new pmcPagination(20, "page");             
mysql_connect("localhost","root","PASSWORD");
mysql_select_db("mytvguide");

//Select only results for today and future
$result = mysql_query("SELECT programme, channel, airdate, expiration, episode, setreminder
                       FROM lagunabeach
                       WHERE expiration >= now() 
                       ORDER BY airdate, 3 ASC
                       LIMIT 0, 100;");

//You can also add results to paginate here
mysql_data_seek($queryresult, 0);

while($row = mysql_fetch_array($result)) {
    $paginator->add(new paginationData($row['programme'],
        $row['channel'],
        $row['airdate'],
        $row['expiration'],
        $row['episode'],
        $row['setreminder']));
}

//Show the paginated results
$paginator->paginate();

include("pca-footer1.php");

//Show the navigation
$paginator->navigation();

Despite me having two records for the programmes airing today, it only shows records from the second one onwards - the programme that airs at 8:35pm UK time GMT does not show, but the later 11:25pm UK time GMT one does show.

How should I fix this? Above is my code if that is of any use!

Thanks

+1  A: 

SELECT programme, channel, airdate, expiration, episode, setreminder FROM lagunabeach where expiration >= now() order by airdate, 3 ASC LIMIT 0, 100;

You are ordering by the same column twice. airdate and 3 are the same column in your sql select statement.

simplemotives
I changed it to $result = mysql_query("SELECT programme, channel, airdate, expiration, episode, setreminder FROM lagunabeach where expiration >= now() order by airdate;"); but the first record still does not show.
whitstone86