•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,552 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,576 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 910 | Replies: 3
![]() |
•
•
Join Date: Nov 2006
Location: South Wales
Posts: 159
Reputation:
Rep Power: 2
Solved Threads: 10
Im assuming your getting the data from a Database. Ill use the example below on PHP/MySQL setup.
You should use something like this;
Hope this helps. PM me if you have any problems.
You should use something like this;
php Syntax (Toggle Plain Text)
<?php $display=10; // The number of records on each page $start=0; $query="SELECT COUNT(*) FROM table_name"; $result=mysql_query($query); $row=mysql_fetch_array($result, MYSQL_NUM); $num_records=$row[0]; //Calculate # of pages required. // If the number of returned records is greater than the $display //number then it will create more pages. if($num_records > $display) { $num_pages=ceil($num_records/$display); }else{ $num_pages=1; } PLACE HERE YOUR SCRIPT TO QUERY THE DATABASE AND DISPLAY THE RESULTS. // Here we make the links to other pages if($num_pages >1) { echo '<BR/><p>'; //Find what page the script is on $current_page=($start/$display) +1; // IF NOT 1st Make a previous button if($current_page !=1) { echo '<a href="page_title.php?s='. ($start - $display) .'$np=' . $num_pages.'">Prev</a>'; } // IF NOT LAST PAGE MAKE A NEXT BUTTON if($current_page !=$num_pages) { echo '<a href="page_title.php?s='.($start + $display).'&np='.$num_pages.'">Next</a>'; } echo '</p>'; } ?>
Hope this helps. PM me if you have any problems.
•
•
Join Date: Jul 2004
Location: North East Indiana
Posts: 491
Reputation:
Rep Power: 5
Solved Threads: 20
You can either learn PHP or hire someone who knows it. Those are your best options, really.
www.uncreativelabs.net
Old computers are getting to be a lost art. Here at Uncreative Labs, we still enjoy using the old computers. Sometimes we want to see how far a particular system can go, other times we use a stock system to remind ourselves of what we once had.
Old computers are getting to be a lost art. Here at Uncreative Labs, we still enjoy using the old computers. Sometimes we want to see how far a particular system can go, other times we use a stock system to remind ourselves of what we once had.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
Similar Threads
- navigate to same page, different question (VB.NET)
- session question (PHP)
- Background question (JavaScript / DHTML / AJAX)
- Front Page Question (Site Layout and Usability)
- iframe help (HTML and CSS)
- force Search Page to return no records on open (ASP)
- Identification of Web Forms (ASP.NET)
Other Threads in the PHP Forum
- Previous Thread: Web development help please, this is baffling the crap out of me
- Next Thread: Shout Box


Linear Mode