duan198299
duan198299
2010-05-28 18:46

第一条记录不会显示在分页脚本中

已采纳

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条回答

  • duanlei1957 duanlei1957 11年前

    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.

    点赞 评论 复制链接分享