» Quick Links
You can make money on these forums
We Share profits with you
Google
Google Adsense
Google Adwords
YPN
Yahoo
MSN Search
Web Directories
Web Hosting
Web Hosting Offers
Hosting News
Suggestions
Link Building
Domain Names
PHP Forums
MySQL Forums
» More Links
OSP News
Reseller Hosting
Shared Hosting
Dedicated Servers
Google Adsense
Search Engine Marketing
Link Development
Affiliate Marketing


» Advertising
Multiple DC PR Check

Free SEO Tools


Go Back   Webmaster Forums > Website Developement / Programming > PHP Programming and Tips

PHP Programming and Tips Discuss about PHP programming and Share Tips. Ask questions about Scripting and Errors.

Reply
 
Thread Tools Display Modes
  #1  
Old 08-28-2006, 01:50 PM
Mclaren Mclaren is offline
Junior Member
 
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
Mclaren is on a distinguished road
Default how to do paging

Dear Friends.

i have 100 records. So i need to do pageing.

As a Eg : i want to show all the records in 10 pages . each page has 10 records. 10 X 10 = 100.

10 pages and each page have 10 records.

how to do it?

Pl help me -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Revenue Sharing Ads ( ?):
  #2  
Old 08-28-2006, 01:57 PM
hannah hannah is offline
OSP Addicts
 
Join Date: Apr 2006
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
hannah is on a distinguished road
Default

HI,

This is the simple code that you can use for paging.
include this code on your page.


Code:
function getPageNum($tblName, $scriptName)
{
$pageNum = 0;
$pageCnt = 0;
$recNum = 10;

$query = "SELECT * FROM $tblName";
$result=mysql_query($query);
$rownum=mysql_num_rows($result);


if($rownum > 0)
{
$pageNum = ceil($rownum/$recNum);

for($i=0; $i<$pageNum; $i++)
{
$pageCnt = $i * $recNum;

if(isset($_REQUEST['pageNo']) AND $_REQUEST['pageNo']== ($i+1))
{
echo "<b>".($i+1)."</b>**";
}
else
{
echo "<a href='$scriptName?recNum=$recNum&startNum=$pageCnt &pageNo=".($i+1)."'> -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 03:35 AM.