/ 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! |
David Barnes, Lead Evangelist for IBM Emerging Internet Technologies will discuss aspects of Web 2.0 that bring value to corporations, academia, and government. He'll also discuss IBM's vision around Web 2.0, including the importance of remixability and consumability. The discussion will culminate with examples of various IBM Software Group solutions you can use to get ahead of the Web 2.0 adoption curve. 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!
|
|
|
|
Discover how IBM Rational AppScan Standard Edition can help you detext vulnerabilities in your web applications in the Web Application Security eKit. IBM Rational AppScan is a leading suite of automated web application security solutions that scan and test for common Web application vulnerabilities. The new Web Application Security eKit provides you with valuable resources, including white papers, demos, and additional information on the benefits of testing your Web applications. 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!
|
|
|
|
This Fall, IBM Rational talks to you directly through a special teleconference series giving you access to the best minds in IBM Rational - product experts and market thought leaders who will answer your questions during these pre-scheduled telephone conference calls. Register today! FREE! Go There Now!
|
|
|
|
Learn the basics of the IBM Customer Information Control System (CICS). With a hands-on exercise, learn how to get your first CICS application up and running on your desktop using TXSeries V6.1 for Windows. The tutorial shows you how to download and install a free trial version of TXSeries V6.1. FREE! Go There Now!
|
|
|
|
Regression testing -- in which code is thoroughly tested to ensure that changes have not produced unexpected results -- is an important part of any development process. But many testing environments neglect the terminal-based applications that still form the backbone of many industries. In this tutorial, you'll learn how the Rational Functional Tester Extension for Terminal-Based Applications works with other Rational Functional Tester to help test terminal-based applications quickly and easily. FREE! Go There Now!
|
|
|
|
Informix Dynamic Server (IDS) Express Edition offers outstanding online transaction processing (OLTP) database performance, while helping to simplify and automate many of the tasks associated with deploying databases for small business applications. IDS 11 further extends the ease of management and applications integration with the Admin API and Scheduler, high availability with Continuous Log Restore for backup server recovery in case of a primary server failure, and column level encryption to protect personal and company private data. 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!
|
|
|
|
Get a free trial download of the latest version of IBM Rational Tester for SOA Quality V7.0.1, a functional and regression testing tool that enables the creation, comprehension, modification and execution of testing GUI-less Web services. FREE! Go There Now!
|
|
|
|
All FREE IBM® developerWorks Tools! |