/ 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! |
Build secure Web services with transport-level security using IBM Rational Application Developer V7 and IBM WebSphere Application Server V6.1. Follow this three-part series for step-by-step instructions about how to develop Web services and clients, configure HTTP basic authentication, and configure HTTP over SSL (HTTPS). This first part of the series walks you through building a Web service for a simple calculator application. You generate and test two different types of Web services clients: a Java Platform, Enterprise Edition (Java EE) client and a stand-alone Java client. You also handle user-defined exceptions in Web services. FREE! Go There Now!
|
|
|
|
Learn how you can extend modern application lifecycle management to IBM System z through the IBM Rational Software Delivery Platform (SDP). The Did you say mainframe? e-kit includes podcasts, webcasts, tutorials, white and red papers, demos, and articles designed to help ease the challenges of modernizing your enterprise. This complimentary kit for mainframe developers is a practical, how-to guide for making the most of an existing development environment, including the skills and infrastructure already in place at an established enterprise. FREE! Go There Now!
|
|
|
|
Because access to government information continues to be an area of concern for many U.S. citizens with disabilities, the U.S. government enacted Section 508 of the Rehabilitation Act in 2001 to ensure that government agencies create accessible Web content, enabling all citizens to access the information they need. A fully accessible Web site makes Web content accessible to all individuals, including those with disabilities, who may be accessing Web content via a variety of user agents. Common user agents include standard Web browsers, text-only browsers, assistive devices and mobile devices such as cell phones or personal digital assistants (PDAs). FREE! Go There Now!
|
|
|
|
This whitepaper provides areas to consider when evaluating any software configuration management solution. It addresses how the IBM solutions (Rational ClearCase and Rational ClearQuest) meet the needs and requirements of both project leaders and developers to provide successful Software Change and Configuration Management. FREE! Go There Now!
|
|
|
|
As organizations have grown increasingly dependent on online software, the risk of malicious attacks has also become far more serious. Fortunately, well-governed organizations can protect their Web applications by injecting vulnerability assessments and ethical hacks into their software development and delivery processes. This paper describes 12 of the most common hacker attacks and provides basic rules that you can follow to help create more hack-resistant Web applications. FREE! Go There Now!
|
|
|
|
This paper is about the critical role that a discipline called integrated requirements management can play in helping to ensure that your business goals and IT investments are continuously aligned—whether you are sourcing, integrating, building or maintaining software. It also looks at ways that automated IBM Rational® products can work together to help you use requirements in the very best way. FREE! Go There Now!
|
|
|
|
Get a free trial download of the latest version of IBM Rational Functional Tester V7.0.1. Rational Functional Tester is an automated functional and regression testing solution for QA teams concerned with the quality of their Java, Microsoft Visual Studio .NET, and Web-based applications. FREE! Go There Now!
|
|
|
|
Try the latest version of IBM Rational Manual Tester V7.0.1 by downloading a free trial from IBM developerWorks. This manual test authoring and execution tool promotes test step reuse to reduce the impact of software change on testers and business analysts and addresses the needs of teams performing at least a portion of their testing manually. FREE! Go There Now!
|
|
|
|
Attend this launch webcast with Scott Hebner, Vice President of IBM Rational Marketing and Strategy, where he will overview Rational’s new offerings and programs to help customers accelerate software innovation on System z. He will discuss how these solutions help organizations extend their core business processes toward modern architectures such as SOA and web technologies to deliver business improvements that stand the test of time. FREE! Go There Now!
|
|
|
|
The discipline of assembling and delivering software is maturing beyond standard developer-centric compile/test software builds. The end-to-end software development lifecycle is emerging as the new focus moves “Beyond the Build.” Join this on demand webcast to learn about methods for streamlining software delivery and key capabilities of the IBM Rational Build Forge framework for automating build and release management in environments of any size. FREE! Go There Now!
|
|
|
|
All FREE IBM® developerWorks Tools! |