|
|
|
|
Like this code?
Show the author your appreciation.
|
|
| |
This is the simple method that manage your huge data by creating the page. I use some dynamic color change via php code
Enjoy the code
conn.php - This is the connection file
| <?php
$db_name="yourdatabasename";
$connection=mysql_connect("hostname","username","password") or die("I Couldn't connect");
$db=mysql_select_db($db_name,$connection) or die("I Couldn't select your database");
?> | |
viewemp.php - The main file
| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Employee Details</title>
<!-- Developed By Suraj Thapaliya http://www.surajthapaliya.com.np -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table width="775" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td> </td>
</tr>
<tr>
<td> <table width="775" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><form method="post" action="">
<table width="775" border="0" align="center" cellpadding="1" cellspacing="1">
<tr>
<td width="357"> </td>
<td width="245" align="right"> </td>
<td width="163" align="center">Current Page No:
<?
$x=$_GET["x"];
$pageno=$x/15 +1;
echo "<b>".$pageno."</b>";
?></td>
</tr>
<tr>
<td colspan="3"><table width="750" border="0" align="center" cellpadding="1" cellspacing="1" bordercolor="#666666" class="allborder">
<tr bgcolor="#CFCFE7">
<td height="20"><strong>Id</strong></td>
<td><strong>Full Name</strong></td>
<td><strong>Department</strong></td>
<td><strong>Gender</strong></td>
<td><strong>Contact</strong></td>
<td><strong>Email</strong></td>
</tr>
<?
$x=$_GET["x"];
if(!isset($x)) $x=0;
include("conn.php");
$tsql="select * from empdetail";
$tresult=mysql_query($tsql,$connection) or die(mysql_error());
$num=mysql_num_rows($tresult);
$sql="select sn,empid,fname,lname,mname,department,branchid,sub_branchid,email from empdetail limit $x,15";
$result=mysql_query($sql,$connection) or die(mysql_error());
$counter=0;
while($row=mysql_fetch_array($result))
{
if($counter==0) {
$color="#EEEEF7";
$counter++;
} else {
$color="#ffffff";
$counter=0;
}
?>
<tr bgcolor="<? echo $color; ?>">
<td height="20"><? echo $row['empid']; ?></td>
<td><? echo $row['fullname']; ?></td>
<td><? echo $row['department']; ?></td>
<td><? echo $row['gender']; ?></td>
<td><? echo $row['contact']; ?></td>
<td><? echo $row['email']; ?></td>
</tr>
<?
}
?>
<tr bgcolor="#CFCFE7">
<td height="20"><strong>Id</strong></td>
<td><strong>Full Name</strong></td>
<td><strong>Department</strong></td>
<td><strong>Gender</strong></td>
<td><strong>Contact</strong></td>
<td><strong>Email</strong></td>
</tr>
<tr>
<td colspan="6">
<?
$page=1;
$increment=0;
$showpage=$num/15;
echo"<font face=verdana size=2><b>Page:</b> </font> ";
for($j=0;$j<$showpage;$j++)
{
if($page==$pageno) {
$size="3";
} else {
$size="2";
}
echo"<a href='viewemp.php?x=$increment'><font face=verdana size=$size>$page</a></font> ";
$page=$page+1;
$increment=$increment+15;
}
?>
</td>
</tr>
</table></td>
</tr>
</table>
</form></td>
</tr>
<tr>
<td>©http://www.surajthapaliya.com.np</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html> | |
Database schema
| create table empdetail
(
id int not null primary key,
fullname varchar(50),
department varchar(50),
gender varchar(10),
contact varchar(50),
email varchar(50)
)
insert into empdetail values(1,'Suraj Thapaliya','Programmer','Male','9803165329','surajthapaliya@gmail.com');
insert into empdetail values(2,'Suraj Thapaliya','Programmer','Male','9803165329','surajthapaliya@gmail.com');
insert into empdetail values(3,'Suraj Thapaliya','Programmer','Male','9803165329','surajthapaliya@gmail.com');
insert into empdetail values(4,'Suraj Thapaliya','Programmer','Male','9803165329','surajthapaliya@gmail.com');
insert into empdetail values(5,'Suraj Thapaliya','Programmer','Male','9803165329','surajthapaliya@gmail.com');
insert into empdetail values(6,'Suraj Thapaliya','Programmer','Male','9803165329','surajthapaliya@gmail.com');
insert into empdetail values(7,'Suraj Thapaliya','Programmer','Male','9803165329','surajthapaliya@gmail.com');
insert into empdetail values(8,'Suraj Thapaliya','Programmer','Male','9803165329','surajthapaliya@gmail.com');
insert into empdetail values(9,'Suraj Thapaliya','Programmer','Male','9803165329','surajthapaliya@gmail.com');
insert into empdetail values(10,'Suraj Thapaliya','Programmer','Male','9803165329','surajthapaliya@gmail.com');
insert into empdetail values(11,'Suraj Thapaliya','Programmer','Male','9803165329','surajthapaliya@gmail.com');
insert into empdetail values(12,'Suraj Thapaliya','Programmer','Male','9803165329','surajthapaliya@gmail.com');
insert into empdetail values(13,'Suraj Thapaliya','Programmer','Male','9803165329','surajthapaliya@gmail.com');
insert into empdetail values(14,'Suraj Thapaliya','Programmer','Male','9803165329','surajthapaliya@gmail.com');
insert into empdetail values(15,'Suraj Thapaliya','Programmer','Male','9803165329','surajthapaliya@gmail.com');
insert into empdetail values(16,'Suraj Thapaliya','Programmer','Male','9803165329','surajthapaliya@gmail.com');
insert into empdetail values(17,'Suraj Thapaliya','Programmer','Male','9803165329','surajthapaliya@gmail.com');
insert into empdetail values(18,'Suraj Thapaliya','Programmer','Male','9803165329','surajthapaliya@gmail.com');
insert into empdetail values(19,'Suraj Thapaliya','Programmer','Male','9803165329','surajthapaliya@gmail.com'); | | |
|
| This program allows you to upload an ODBC ressource - i.e. an MS-Access database to a MySQL server. Categories : Databases, MySQL, Complete Programs, PHP, Databases | | | bookmarker - PHP, PHPLIB, MySQL WWW based bookmark manager Categories : MySQL, PHP, MySQL, Complete Programs, Databases | | | Accepts a database & hostname from a user and then HTTP username and password. Uses this to connect to a MySQL database. Produces a form based on the tables it finds there to allow the user to do SELECTs, INSERTs, and DELETEs. Categories : Databases, PHP, MySQL, Complete Programs | | | phpAds, a complete banner and ad management system with detailled tracking and stats. Categories : MySQL, Complete Programs, Ecommerce, PHP, Databases | | | Point and Click Interface ala MS Access for creating SQL statements. Categories : MySQL, Complete Programs, General SQL, PHP, Databases | | | Message of the Day - Random Message (Needs MySQL!) Categories : Databases, HTML and PHP, PHP, MySQL | | | email new items in db Categories : PHP, Email, Databases, MySQL, Beginner Guides | | | Alternating background color for HTML table rows Categories : PHP, Databases, MySQL, HTML and PHP | | | color codes for positive and negative numbers Categories : PHP, MySQL, Databases, HTML | | | A very simple way to build and do a hierarchical html categories browser without javascript , just using html php and mySql
Categories : HTML and PHP, Databases, Algorithms, PHP, MySQL | | | Linked comboboxes with php-mysql & javascript Categories : PHP, Java Script, Databases, MySQL | | | mysql_escape_string Categories : PHP, MySQL, Databases, Strings | | | Automatically printing the contents of an sql table in MySQL. Categories : MySQL, PHP, HTML and PHP, Databases | | | usercounter class Categories : PHP, PHP Classes, Databases, MySQL, Environment Variables | | | This script is a contact form between users of a
website (kinda like the PM function on the forums)
Categories : PHP, Databases, MySQL, Regexps | |
|
|
|