$ QH = mysql_query ("select count (*) as rcnt from table where your_condition_here order by whatever");
$ DATA = mysql_fetch_array ($ QH );
$ Nr = $ data ["rcnt"];
// determine whether the offset parameter is passed to the script, if not, use the default value 0
If (empty ($ offset)
{< br> $ offset = 0;
}< br> // query result (20 entries per page, but you can change it by yourself)
$ result = mysql_query ("select ID, name, phone from table where your_condition_here order by whatever limit $ offset, 20 ");
// display the returned 20 records
while ($ DATA = mysql_fetch_array ($ result ))
{< br> // replace it with the Code
}< br> // next step, link to write to other pages
If (! $ Offset) // If the offset is 0, the link to the previous page is not displayed
{< br> $ preoffset = $ offset-20;
Print " previous page & nbsp ;";
}< br> // calculate the total number of required pages
$ pages = Ceil ($ NR/20 ); // $ pages variable now contains the required page number
for ($ I = 1; $ I <= $ pages; $ I)
{< br> $ newoffset = 20 * $ I;
Print "$ I & nbsp;";
}< br> // check whether it is the last page
if ($ pages! = 0 & ($ newoffset/20 )! = $ Pages)
{< br> Print " next page & nbsp;";
}< BR >?>