https://drive.google.com/file/d/0B786DFPmxyizRkhMaEFJVUQ0dDg/view?usp=sharing
1) connection.php
$host="localhost";
$user="root";
$pass="";
//connection
$con=mysql_connect($host,$user,$pass) or die(mysql_error());
//db selection
mysql_select_db("test123",$con);
?>
2) index.php
include('connection.php'); //include of db config file
include ('paginate.php'); //include of paginat page
extract($_POST);
if(isset($save))
{
//check user already exists or not
$q=mysql_query("select email from users where email='$e'");
$r=mysql_num_rows($q);
if($r){
echo "$e already exists";
}
else{
//for image
$img=$_FILES['img']['name'];
//hobbies
$hobbies=implode(",",$hobb);
//dob
$dob=$yy."-".$mm."-".$dd;
//save data
$query="insert into users values('','$n','$e','$p','$add','$mob','$gen','$img','$hobbies','$c','$dob',now())";
mysql_query($query);
//save user's image
mkdir("image/$e");
move_uploaded_file($_FILES['img']['tmp_name'],"image/$e/".$_FILES['img']['name']);
echo "Congrates !";
}
}
?>
Name
Email
Password
Address
Mobile
gender
male
female
hobbies
cricket
singing
dancing
country
Dob
for($i=1900;$i<=2015;$i++)
{
echo "";
}
?>
for($i=1;$i<=12;$i++)
{
echo "";
}
?>
for($i=1;$i<=31;$i++)
{
echo "";
}
?>
Image
Name
Email
Address
Mobile
Image
$per_page = 5; // number of results to show per page
$result = mysql_query("SELECT * FROM users");
$total_results = mysql_num_rows($result);
$total_pages = ceil($total_results / $per_page);//total pages we going to have
//-------------if page is setcheck------------------//
if (isset($_GET['tpages']))
{
$show_page = $_GET['tpages']; //it will telles the current page
if ($show_page > 0 && $show_page <= $total_pages) {
$start = ($show_page - 1) * $per_page;
$end = $start + $per_page;
} else {
// error - show first set of results
$start = 0;
$end = $per_page;
}
} else {
// if page isn't set, show first set of results
$start = 0;
$end = $per_page;
}
// display pagination
$page = intval($_GET['tpages']);
$tpages=$total_pages;
if ($page <= 0)
$page = 1;
//$query=mysql_query("select * from users");
for ($i = $start; $i < $end; $i++)
{
if ($i == $total_results)
{
break;
}
?>
" width="40px" />
Edit
Delete
$reload = "index.php" . "?tpages=" . $tpages;
echo '
if ($total_pages > 1) {
echo paginate($reload, $show_page, $total_pages);
}
echo "
"; ?>
3) paginate.php
function paginate($reload, $page, $tpages)
{
$adjacents = 2;
$prevlabel = "‹ Prev";
$nextlabel = "Next ›";
$out = "";
// previous
if ($page == 1) {
$out.= "" . $prevlabel . "\n";
} elseif ($page == 2) {
$out.= "
" . $prevlabel . "\n
";
} else {
$out.= "
" . $prevlabel . "\n
";
}
$pmin = ($page > $adjacents) ? ($page - $adjacents) : 1;
$pmax = ($page < ($tpages - $adjacents)) ? ($page + $adjacents) : $tpages;
for ($i = $pmin; $i <= $pmax; $i++) {
if ($i == $page) {
$out.= "
" . $i . "
\n";
} elseif ($i == 1) {
$out.= "
" . $i . "\n
";
} else {
$out.= "
" . $i . "\n
";
}
}
if ($page < ($tpages - $adjacents)) {
$out.= "" . $tpages . "\n";
}
// next
if ($page < $tpages) {
$out.= "
" . $nextlabel . "\n
";
} else {
$out.= "" . $nextlabel . "\n";
}
$out.= "";
return $out;
}
Name
Email
Password
Address
Mobile
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` char(50) NOT NULL,
`email` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
`address` varchar(255) NOT NULL,
`mobile` bigint(20) NOT NULL,
`gender` enum('m','f') NOT NULL,
`image` varchar(255) NOT NULL,
`hobbies` varchar(100) NOT NULL,
`country` char(50) NOT NULL,
`dob` date NOT NULL,
`regDate` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`),
UNIQUE KEY `mobile` (`mobile`),
UNIQUE KEY `email_2` (`email`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
1) connection.php
$host="localhost";
$user="root";
$pass="";
//connection
$con=mysql_connect($host,$user,$pass) or die(mysql_error());
//db selection
mysql_select_db("test123",$con);
?>
2) index.php
include('connection.php'); //include of db config file
include ('paginate.php'); //include of paginat page
extract($_POST);
if(isset($save))
{
//check user already exists or not
$q=mysql_query("select email from users where email='$e'");
$r=mysql_num_rows($q);
if($r){
echo "$e already exists";
}
else{
//for image
$img=$_FILES['img']['name'];
//hobbies
$hobbies=implode(",",$hobb);
//dob
$dob=$yy."-".$mm."-".$dd;
//save data
$query="insert into users values('','$n','$e','$p','$add','$mob','$gen','$img','$hobbies','$c','$dob',now())";
mysql_query($query);
//save user's image
mkdir("image/$e");
move_uploaded_file($_FILES['img']['tmp_name'],"image/$e/".$_FILES['img']['name']);
echo "Congrates !";
}
}
?>
Name
Password
Address
Mobile
gender
male
female
hobbies
cricket
singing
dancing
country
Dob
for($i=1900;$i<=2015;$i++)
{
echo "";
}
?>
for($i=1;$i<=12;$i++)
{
echo "";
}
?>
for($i=1;$i<=31;$i++)
{
echo "";
}
?>
Image
Name
Address
Mobile
Image
$per_page = 5; // number of results to show per page
$result = mysql_query("SELECT * FROM users");
$total_results = mysql_num_rows($result);
$total_pages = ceil($total_results / $per_page);//total pages we going to have
//-------------if page is setcheck------------------//
if (isset($_GET['tpages']))
{
$show_page = $_GET['tpages']; //it will telles the current page
if ($show_page > 0 && $show_page <= $total_pages) {
$start = ($show_page - 1) * $per_page;
$end = $start + $per_page;
} else {
// error - show first set of results
$start = 0;
$end = $per_page;
}
} else {
// if page isn't set, show first set of results
$start = 0;
$end = $per_page;
}
// display pagination
$page = intval($_GET['tpages']);
$tpages=$total_pages;
if ($page <= 0)
$page = 1;
//$query=mysql_query("select * from users");
for ($i = $start; $i < $end; $i++)
{
if ($i == $total_results)
{
break;
}
?>
Edit
Delete
$reload = "index.php" . "?tpages=" . $tpages;
echo '
- ';
if ($total_pages > 1) {
echo paginate($reload, $show_page, $total_pages);
}
echo "
"; ?>
3) paginate.php
function paginate($reload, $page, $tpages)
{
$adjacents = 2;
$prevlabel = "‹ Prev";
$nextlabel = "Next ›";
$out = "";
// previous
if ($page == 1) {
$out.= "" . $prevlabel . "\n";
} elseif ($page == 2) {
$out.= "
} else {
$out.= "
}
$pmin = ($page > $adjacents) ? ($page - $adjacents) : 1;
$pmax = ($page < ($tpages - $adjacents)) ? ($page + $adjacents) : $tpages;
for ($i = $pmin; $i <= $pmax; $i++) {
if ($i == $page) {
$out.= "
} elseif ($i == 1) {
$out.= "
} else {
$out.= "
}
}
if ($page < ($tpages - $adjacents)) {
$out.= "" . $tpages . "\n";
}
// next
if ($page < $tpages) {
$out.= "
} else {
$out.= "" . $nextlabel . "\n";
}
$out.= "";
return $out;
}
4) Delete.php
include('connection.php');
$sql=mysql_query("delete from users where email='{$_GET['email']}'");
unlink("image/".$_GET['email']."/".$_GET['image']);
rmdir("image/".$_GET['email']);
header('location:index.php');
?>
5) edit.php
include('connection.php');
$sql=mysql_query("select * from users where email='{$_GET['email']}'");
$row=mysql_fetch_array($sql);
extract($_POST);
if($upd)
{
mysql_query("update users set name='$n',password='$p',address='$add',mobile='$mob' where email='{$_GET['email']}'");
header('location:index.php');
}
?>
Name
Password
Address
Mobile
style.css
.pagination{height:40px;margin:20px 0}.pagination ul{display:inline-block;*display:inline;margin-bottom:0;margin-left:0;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;*zoom:1;-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:0 1px 2px rgba(0,0,0,0.05);box-shadow:0 1px 2px rgba(0,0,0,0.05)}.pagination li{display:inline}.pagination a,.pagination span{float:left;padding:0 14px;line-height:38px;text-decoration:none;background-color:#fff;border:1px solid #ddd;border-left-width:0}.pagination a:hover,.pagination .active a,.pagination .active span{background-color:#f5f5f5}.pagination .active a,.pagination .active span{color:#999;cursor:default}.pagination .disabled span,.pagination .disabled a,.pagination .disabled a:hover{color:#999;cursor:default;background-color:transparent}.pagination li:first-child a,.pagination li:first-child span{border-left-width:1px;-webkit-border-radius:3px 0 0 3px;-moz-border-radius:3px 0 0 3px;border-radius:3px 0 0 3px}.pagination li:last-child a,.pagination li:last-child span{-webkit-border-radius:0 3px 3px 0;-moz-border-radius:0 3px 3px 0;border-radius:0 3px 3px 0}.pagination-centered{text-align:center}.pagination-right{text-align:right}
table,td{padding:5px;border-radius:5px}
input,textarea{width:220px}
input[type=radio],input[type=checkbox]{width:20px}
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` char(50) NOT NULL,
`email` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
`address` varchar(255) NOT NULL,
`mobile` bigint(20) NOT NULL,
`gender` enum('m','f') NOT NULL,
`image` varchar(255) NOT NULL,
`hobbies` varchar(100) NOT NULL,
`country` char(50) NOT NULL,
`dob` date NOT NULL,
`regDate` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email` (`email`),
UNIQUE KEY `mobile` (`mobile`),
UNIQUE KEY `email_2` (`email`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;