/ Pagination script
/* This simple script automates the creation of navigation links for the datas extracted from
the database.Pls Feel free to modify it and mailme back.Thanx
Author: Sam George; ocptime@rediffmail.com
Licence: GPL.
*/
// No Files are included and stylesheets and other config files can be
// included according to your wish.
// Uses ADO_DB for database abstraction and no documentation as the script is fairly straight forward
By : ocptime
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<!-- Creation Date: <?=Date("d/m/Y")?> -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Dev-PHP 1.9.4">
<title>Document Title</title>
</head>
<body>
<?php
// Pagination script
/* This simple script automates the creation of navigation links for the datas extracted from
the database.Pls Feel free to modify it and mailme back.Thanx
Author: Sam George; ocptime@rediffmail.com
Licence: GPL.
*/
// No Files are included and stylesheets and other config files can be
// included according to your wish.
// Uses ADO_DB for database abstraction and no documentation as the script is fairly straight forward
$sqlCount="SELECT count(u.id) FROM msg_mail as m, user as u
WHERE m.userTo='$userId'
AND m.status <> 'trash'";
$rsCount = $db->Execute($sqlCount);
$totalrows = $rsCount->fields[0];
$limit=5;
if(empty($page)){
$page = 1;
}
$limitvalue = ($page - 1) * $limit;
$sql = "SELECT m.mailId, m.userTo, m.userFrom, ".$db->substr."(m.subject,1,25) as subject, m.status, u2.name, u.userName, m.date
FROM msg_mail as m, user as u
WHEREm.userTo='$userId'
AND m.status <> 'trash'
ORDER BY m.date DESC LIMIT $limitvalue, $limit";
$rs = $db->Execute($sql);
if($rs->RecordCount()>0){
while($row = $rs->FetchRow()){
$userTo=$row['userTo'];
$userFrom=$row['name'];
$mailId=$row['mailId'];
$subject=$row['subject'];
$message=$row['message'];
//put uer <td> and <tr> here to fill the data
}
if($page > 1){
$pageprev = $page-1;
echo("<a href=\"mypage.php?page=$pageprev\">PREV</a> ");
}
$numofpages = ceil($totalrows / $limit);
for($i = 1; $i <= $numofpages; $i++){
if($page == $i){
echo($i." ");
}else
echo("<a href=\"mypage.php?page=$i\">$i</a> ");
}
if($page < $numofpages){
$pagenext = ($page + 1);
echo ("<a href=\"mypage.php?page=$pagenext\">NEXT</a>");
}
?>
</body>
</html>
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
More Link Farm Code Articles
More By Codewalkers
developerWorks - FREE Tools! |
Hear how IBM Rational Project and Portfolio Management integrated solutions help teams put the right tools and processes in place to maximize the effectiveness and efficiency of project teams and ensure that the business vision is being executed correctly. Learn how to automate and integrate requirements prioritization, top-down project planning, communications and controls, and methodology deployment to keep your scope, costs, and schedules under control. Tackle with an end-to-end approach the management of scope and scope changes, usage of methodology to control and empower project teams, and optimization of resources to align activity costs with the overall project plan. FREE! Go There Now!
|
|
|
|
Learn field-tested SOA principles, methodology, technology and implementation from the global SOA market leader - in a new e-book by an IBM SOA expert. Written by IBM Certified SOA Solution Designer Bobby Woolf, "Exploring IBM SOA Technology & Practice" is the ultimate insider's guide to SOA - a PDF e-book packed cover to cover with IBM's specific advice on how to make your SOA implementation a success. FREE! Go There Now!
|
|
|
|
Download the Rational Application Developer (RAD) v7.5 open beta code and start developing applications for the JEE5 standard which features EJB3.0, JPA, JSF 1.2, JSP 2.1 and Servlet 2.5 standards. When you use this beta you will see how you can increase developer productivity for already existing applications with improved support for refactoring, as well as adding new features to existing applications. In addition, the beta provides tooling for JD Edwards, Oracle, SAP, Siebel and PeopleSoft to improve the developer productivity with these enterprise systems. FREE! Go There Now!
|
|
|
|
Portfolio Management is about effectively managing portfolio value by aligning portfolio investments with business goals. This complimentary e-kit provides a collection of materials that can help you understand how IBM Rational enables and automates best practices for improved governance and clear visibility into portfolio and project performance across the entire IT project lifecycle. FREE! Go There Now!
|
|
|
|
Join this Rational Talks to You teleconference on December 4 at 1:00 pm ET to discuss how Rational Method Composer can help meet your compliance objectives. Get your questions answered! FREE! Go There Now!
|
|
|
|
Join this webcast to discover the key requirements for successful change and release management. Learn how to extend your .NET environment to improve productivity and collaboration, and address core problems afflicting team development. In this webcast, we’ll review typical challenges faced by customers and how to resolve them with the IBM Rational Change and Release Management solution, including Rational ClearCase, Rational ClearQuest and Rational Build Forge. Replay is available for 9 months. FREE! Go There Now!
|
|
|
|
Get a free trial download of the latest version of IBM Rational Performance Tester V7.0.1, a load and performance testing solution for teams concerned about the scalability of their Web-based applications. Combining multiple ease-of-use features with granular detail, Rational Performance Tester simplifies the test-creation, load-generation and data-collection processes that help teams ensure the ability of their applications to accommodate required user loads. FREE! Go There Now!
|
|
|
|
You can now evaluate IBM Rational Asset Manager V7.0 online without installing or configuring it on your own system! Rational Asset Manager helps create, modify, govern, find, and reuse any type of development assets, including SOA and systems development assets. Rational Asset Manager helps you reduce software development costs and improve quality by facilitating the reuse of all types of software development-related assets. Visit developerWorks to learn more about this product and register to explore its capabilities online. FREE! Go There Now!
|
|
|
|
Join this webcast to learn how IBM Rational's Functional Testing solution enables you to implement automation your way, at your pace, with your existing staff. In this webcast, you’ll learn how you can eliminate redundancy of manual test scripts, reduce errors, and increase test coverage through test automation. After this presentation you will understand how IBM Rational Functional Testing solution can streamline your manual testing and make test automation easily attainable. FREE! Go There Now!
|
|
|
|
The unprecedented scope of a service-oriented architecture (SOA) initiative brings to the forefront a number of management and governance issues that were sidestepped in the past. The key to a successful SOA implementation is managing and governing activities throughout the entire SOA delivery lifecycle by ensuring that services conform to the needs of all of the business’s stakeholders. Learn how service lifecycle management allows the business to ensure that the process by which services are defined, created, tested, deployed, optimized and retired is manageable, repeatable and auditable. FREE! Go There Now!
|
|
|
|
All FREE IBM® developerWorks Tools! |