views:

24

answers:

1

Hi,

I have html page whicha has 5 Div tags in disable mode. what I want is

Imagine I have 200 records in mysql database table

  1. Using Jquery I want to call PHP Mysql data (only 5 records at a time)
  2. When user clicks on Next button PHP page will get called Limit 6, 10 and so on
  3. if user clicks on Prev button then previous 5 records

following example is good enough bit it has pagination with numbers i want Next/Prev buttons.

http://www.9lessons.info/2009/09/pagination-with-jquery-mysql-and-php.html

A: 

For starters in pagination.php

Change this:

//Pagination Numbers
for($i=1; $i<=$pages; $i++)
{
echo '<li id="'.$i.'">'.$i.'</li>';
}

To this:

// Show 'next' link
echo '<li id="'.2.'">Next page</li>';

To create you first 'next'-link.

Then add some jQuery code to

  • Add a prev button when you click to the next page(only if currentpage = 1) and remove it again on page 1
  • Include your result's count as a js-var, so you will know when the last page is reached to remove the next button.
  • On each load, change page number's +/- 1

Your php stays the same since you always send a page id to use in your query.

Have you tried writing this yourself? If so, where did you encounter problems?

Rakward