/ 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! |
Hold your calendar on January 30, 2008 for this free webcast on the new i5/OS. Rational's Enterprise Modernization products will be discussed at this webcast as they help to drive the application development environment for this new System i OS. <br />And learn how i5/OS will take you to the next step of efficient, resilient business processing. You will hear about the new i5/OS capabilities as it will be the most significant i5/OS release in years. If you cannot join the webcast on 1/30/08 you can still use this link to listen to the replay.<br /> FREE! Go There Now!
|
|
|
|
This demonstration gives you an overview of IBM® Rational® Build Forge Express Edition, a global offering that provides a framework to automate and execute software processes. Rational Build Forge provides a software assembly line that can support all of your tools, technologies, and platforms so you can achieve a repeatable, reliable, and traceable build and release process. FREE! Go There Now!
|
|
|
|
This whitepaper presents the benefits of successfully introducing static analysis into your organization using IBM Rational Software Analyzer. Additionally, it identifies some common pitfalls that can hinder the effective use of static analysis tooling as well as presents 10 simple strategies designed to help you quickly realize the value of static analysis using Rational Software Analyzer. FREE! Go There Now!
|
|
|
|
Visit IBM developerWorks to download a free trial of the latest release of IBM Lotus Sametime Standard V8.0. Lotus Sametime Standard V8.0 is a platform for unified communications and collaboration that combines security features with an extensible, open solution including integrated Voice over IP, geographic location awareness, mobile clients, and a robust Business Partner community offering telephony and video integration. FREE! Go There Now!
|
|
|
|
Learn how Rational Build Forge can extend a simple compile and package build process by adding customization and deployment capability. Go from a manual method to automating: checking for code changes; getting the latest source; compiling and packaging; customizing; copying to and restarting a deployment server; and sending e-mail notification that a new version is available. FREE! Go There Now!
|
|
|
|
Listen to this webcast to get an overview of Info 2.0 and a technical demo of how to quickly build an enterprise mashup. IBM's Info 2.0 technology leverages emerging Web 2.0 technologies such as mashups, feeds, AJAX, and JSON in order to simplify assembly of information using feeds and services. Come learn about the technical elements of Info 2.0 including the Feed Generation framework, Mashup Engine, and mashup assembly components. Learn how to pull information from databases, departmental information, and the Web to create mashups critical to your company’s success. We will also discuss best practices to help you get started. FREE! Go There Now!
|
|
|
|
This webcast outlines the best practices that must be instituted to gain the maximum benefit from SOA while maintaining high quality of service. Whether you are deploying new applications or managing and monitoring your existing infrastructure, learn how you can ensure high quality of services with SOA based solutions from IBM. All registrants who attend this live Web Seminar will receive complimentary access to a white paper titled “Maintaining QoS in an SOA Environment”. FREE! Go There Now!
|
|
|
|
Join the IBM Watchfire team for an informative discussion on techniques and best practices to proactively manage Web application security and how to effectively build application security testing into the software development lifecycle (SDLC). In this Software Delivery Platform webcast you will learn: How to better understand potential web application security vulnerabilities, best practices and how to effectively integrate application security testing into the software development lifecycle, the importance of detecting and removing software vulnerabilities during application development. FREE! Go There Now!
|
|
|
|
In this webcast, you'll get an introduction to the eXtreme Transaction Processing (XTP) features of WebSphere Extended Deployment and the common architectural traits required by XTP applications. See how WebSphere Extended Deployment's ObjectGrid feature provides a state-of-the-art infrastructure for hosting XTP applications. 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! |