Ajax Example
Screen shot
index.php

<?php
$conn=mysql_connect('localhost','root','') or die('Mysql Not connected');
$database=mysql_select_db('test',$conn) or die('Database Not connected');

if(isset($_REQUEST['start']))
$start_no=$_REQUEST['start'];
else
$start_no=0;
$page_size=8;
$query="SELECT * FROM products limit $start_no,$page_size";
$query2="SELECT * FROM products";
$data=mysql_query($query);
$data2=mysql_query($query2);
$total_records=mysql_num_rows($data2);
$a= $total_records;
$i=0;
?>
<html>
<head>
<title>PHP Example</title>
<script language="javascript" src="ajax.js">
</script>
</head>
<body>
<div name="txt" id="txt">
<table border='1'>
<tr>
<th>Sno</th>
<th>Record1</th>
<th>Record2</th>
</tr>
<?php
while($row=mysql_fetch_array($data))
{
$i++;
?>
<tr>
<td><?php echo $i; ?></td>
<td><?php echo $row[1]; ?></td>
<td><?php echo $row[5]; ?></td>
</tr>
<?php
}
?>
</table>
<br>

<table border="0">
<tr>
<?php
$page_no=1;
$t=1;
$m=0;
?>
<td>
<a id="p" href="javascript:product(<?php echo $m; ?>)">First</a></td>
<td>
<?php
while($a>0)
{
if($m==$start_no)
echo "<font color='red'>".$t."</font>"." ";
else
{
?>
<a id="pannel" href="javascript:product(<?php echo $m; ?>)"><?php echo $t;?></a>&nbsp;
<?php
}
$t=$t+1;
$a=$a-8;
$m=$m+8;
}
?></td>
<td>
<a id="p" href="javascript:product(<?php echo $m-8; ?>)">Last</a>
</td>
</tr>
</table>
</div>
</body>

ajax.js

var XMLHttpRequestObject=false;

function product(user)
{

if(window.XMLHttpRequest)
{
XMLHttpRequestObject=new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
XMLHttpRequestObject=new ActiveXObject("Microsoft.XMLHTTP");
}


XMLHttpRequestObject.onreadystatechange=function()
{
if (XMLHttpRequestObject.readyState==4 && XMLHttpRequestObject.status==200)
{
document.getElementById('txt').innerHTML=XMLHttpRequestObject.responseText;
}
}
XMLHttpRequestObject.open("GET","index.php?start="+user,true);
XMLHttpRequestObject.send();
}

Database

--
-- Database: `test`
--

-- --------------------------------------------------------

--
-- Table structure for table `products`
--

CREATE TABLE IF NOT EXISTS `products` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,
  `Code` varchar(20) NOT NULL,
  `Type` varchar(20) NOT NULL,
  `Name` varchar(30) NOT NULL,
  `Price` float(10,2) NOT NULL,
  `Image` varchar(50) NOT NULL,
  `Description` text NOT NULL,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `Code` (`Code`),
  KEY `Type` (`Type`),
  KEY `Type_2` (`Type`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=40 ;

--
-- Dumping data for table `products`
--

INSERT INTO `products` (`ID`, `Code`, `Type`, `Name`, `Price`, `Image`, `Description`) VALUES
(1, '570D-E-F', 'Bracelets', 'BRL', 5800.00, 'BRA (1).jpg', ''),
(2, '571-A-B', 'Bracelets', 'BRL', 25000.00, 'BRA (2).jpg', ''),
(3, '570G-H', 'Bracelets', 'BRL', 6000.00, 'BRA (3).jpg', ''),
(4, '571E-F', 'Bracelets', 'BRL', 4500.00, 'BRA (4).jpg', ''),
(5, '571C-D', 'Bracelets', 'BRL', 22000.00, 'BRA (5).jpg', ''),
(6, '570G-H.', 'Bracelets', 'BRL', 5000.00, 'BRA (6).jpg', ''),
(7, '572D-E-F-G', 'Bracelets', 'BRL', 32000.00, 'BRA (7).jpg', ''),
(8, '573B-C', 'Bracelets', 'BRL', 6550.00, 'BRA (8).jpg', ''),
(9, '572-A-B-C', 'Bracelets', 'BRL', 7880.00, 'BRA (9).jpg', ''),
(10, '572H-I-J-K-L', 'Bracelets', 'BRL', 11425.00, 'BRA (10).jpg', ''),
(11, '638D-E', 'Earring', 'ER', 18800.00, 'ERN (1).jpg', ''),
(12, '638-A', 'Earring', 'ER', 35000.00, 'ERN (2).jpg', ''),
(13, '638B-C', 'Earring', 'ER', 25000.00, 'ERN (3).jpg', ''),
(14, '638F-G', 'Earring', 'ER', 3200.00, 'ERN (4).jpg', ''),
(15, '638H-I', 'Earring', 'ER', 0.00, 'ERN (5).jpg', ''),
(16, '638J-K', 'Earring', 'ER', 7600.00, 'ERN (6).jpg', ''),
(17, '639-A', 'Earring', 'ER', 86000.00, 'ERN (7).jpg', ''),
(18, '639B-C', 'Earring', 'ER', 65000.00, 'ERN (8).jpg', ''),
(19, '639D-E', 'Earring', 'ER', 4000.00, 'ERN (9).jpg', ''),
(20, '639F-G', 'Earring', 'ER', 0.00, 'ERN (10).jpg', ''),
(21, '639H-I', 'Earring', 'ER', 0.00, 'ERN (11).jpg', ''),
(22, '639J-K', 'Earring', 'ER', 5000.00, 'ERN (12).jpg', ''),
(23, '640B-C', 'Earring', 'ER', 0.00, 'ERN (13).jpg', ''),
(24, '640H-I', 'Earring', 'ER', 0.00, 'ERN (14).jpg', ''),
(25, '640-A', 'Earring', 'ER', 0.00, 'ERN (15).jpg', ''),
(26, '640F-G', 'Earring', 'ER', 0.00, 'ERN (16).jpg', ''),
(27, '640J-K', 'Earring', 'ER', 0.00, 'ERN (17).jpg', ''),
(28, '640D-E', 'Earring', 'ER', 0.00, 'ERN (18).jpg', ''),
(29, '641B-C', 'Earring', 'ER', 0.00, 'ERN (19).jpg', ''),
(30, '641-A', 'Earring', 'ER', 0.00, 'ERN (20).jpg', ''),
(31, '641D-E', 'Earring', 'ER', 0.00, 'ERN (21).jpg', ''),
(32, '641F-G', 'Earring', 'ER', 0.00, 'ERN (22).jpg', ''),
(33, '642B-C', 'Earring', 'ER', 0.00, 'ERN (23).jpg', ''),
(34, '641H-I', 'Earring', 'ER', 0.00, 'ERN (24).jpg', ''),
(35, '641J-K', 'Earring', 'ER', 0.00, 'ERN (25).jpg', ''),
(36, '642-A', 'Earring', 'ER', 0.00, 'ERN (26).jpg', ''),
(37, '642D-E', 'Earring', 'ER', 0.00, 'ERN (27).jpg', ''),
(38, '642F-G', 'Earring', 'ER', 0.00, 'ERN (28).jpg', ''),
(39, '643-A', 'Earring', 'ER', 0.00, 'ERN (29).jpg', '');

You can download source code here