PHP / Ajax分页缩略图

My main goal is to create a Pagination with photo thumbnails. I have successfully managed to create my own pagination. But the problem is, I know how to use ajax, I just don't know how to apply ajax to it so that it is more user friendly. Can someone help me out, I have been struggling to find an answer to this problem. Below is my code.

<?php
  require 'php/connect.inc.php';
  $per_page = 3;

  $pages_query = mysql_query("SELECT COUNT('id') FROM my_list");
  $pages = ceil(mysql_result($pages_query, 0) / $per_page);

  $page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1;
  $start = ($page - 1) * $per_page;


  $query = mysql_query("SELECT id, image_small FROM my_list LIMIT $start, $per_page");
  while($mysql_fetch_assoc = mysql_fetch_assoc($query)){
    echo "<img src=".'img/uploads/'.$mysql_fetch_assoc['image_small'].">";
  }

  if ($pages >= 1 && $page <= $pages){
    for ($x=1; $x <= $pages; $x++){
      echo ($x == $page) ? '<strong><a href="?page='.$x.'">'.$x.'</a></strong> ' : '<a href="?page='.$x.'">'.$x.'</a>';
    }
  }
?>
查看全部
douyun3022
douyun3022
2013/04/13 05:05
  • database
  • pagination
  • php
  • ajax
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

1个回复