DB Example

Download ClickHere  db_test

Download New File Click Here  db_test_new
— Database
— phpMyAdmin SQL Dump
— version 3.3.9
http://www.phpmyadmin.net

— Host: localhost
— Generation Time: Jul 28, 2013 at 08:16 PM
— Server version: 5.5.8
— PHP Version: 5.3.5

SET SQL_MODE=”NO_AUTO_VALUE_ON_ZERO”;


— Database: `db_test`

— ——————————————————–


— Table structure for table `country`

CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;


— Dumping data for table `country`

INSERT INTO `country` (`id`, `name`) VALUES
(1, ‘India’),
(2, ‘China’);

— ——————————————————–


— Table structure for table `registration`

CREATE TABLE IF NOT EXISTS `registration` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`f_name` varchar(50) NOT NULL,
`l_name` varchar(50) NOT NULL,
`email` varchar(50) NOT NULL,
`password` varchar(50) NOT NULL,
`city` varchar(10) NOT NULL,
`country` varchar(10) NOT NULL,
`state` varchar(10) NOT NULL,
`zip` varchar(10) NOT NULL,
`gender` int(1) NOT NULL,
`image` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;


— Dumping data for table `registration`

INSERT INTO `registration` (`id`, `f_name`, `l_name`, `email`, `password`, `city`, `country`, `state`, `zip`, `gender`, `image`) VALUES
(1, ‘Bharat007’, ‘Bhajgotar007’, ‘admin@yahoo.com’, ‘admin007’, ‘Veraval007’, ‘2’, ‘5’, ‘390007007’, 1, ”),
(2, ‘Bharat001’, ‘Bhajgotar001’, ‘admin@yahoo.com’, ‘admin001’, ‘Veraval001’, ‘1’, ‘4’, ‘390007001’, 0, ”),
(3, ‘BM’, ‘BMB’, ‘bmb@yahoo.com’, ‘admin’, ‘Sutrapada’, ‘1’, ‘3’, ‘390007’, 1, ”);

— ——————————————————–


— Table structure for table `state`

CREATE TABLE IF NOT EXISTS `state` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`country_id` varchar(50) NOT NULL,
`name` varchar(50) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;


— Dumping data for table `state`

INSERT INTO `state` (`id`, `country_id`, `name`) VALUES
(1, ‘1’, ‘Gujarat’),
(2, ‘1’, ‘Rajasthan’),
(3, ‘1’, ‘Punjab’),
(4, ‘1’, ‘Bihar’),
(5, ‘2’, ‘Jerburg’),
(6, ‘2’, ‘Libron’);
========================================================================================

db_conn.php
____________________________________________________________________________________________________
<?php
$con = mysql_connect(“localhost”,”root”,””);

if (!$con)
{
die(‘Could not connect: ‘ . mysql_error());
}

mysql_select_db(“db_test”, $con);
?>

edit.php
___________________________________________________________________________________________________
<?php
error_reporting(0);
require(‘db_conn.php’);

$result = mysql_query(“SELECT * FROM registration WHERE id = “.$_REQUEST[‘id’]);
$result = mysql_fetch_row($result);
//echo ‘<pre>’; print_r($result);

if(isset($_REQUEST[‘submit’]) && $_REQUEST[‘submit’]==’Update’){
extract($_POST);
//echo ‘<pre>’; print_r($_REQUEST);
//echo ‘<pre>’; print_r($_POST);
//die();

// Image Upload start.
if(isset($_FILES[‘image’][‘name’])){
$dest = “uploads/”;
$image = $_FILES[‘image’][‘name’];
move_uploaded_file($_FILES[‘image’][‘tmp_name’],$dest.$image);
}else{
$image = $h_image;
}
// End Image Upload.

$query = (“UPDATE registration SET f_name = ‘$f_name’,
l_name = ‘$l_name’,
email = ‘$email’,
password = ‘$password’,
city = ‘$city’,
country = ‘$country’,
state = ‘$state’,
zip = ‘$zip’,
gender = ‘$gender’ WHERE id = “.$_REQUEST[‘id’]);
mysql_query($query);
echo ‘<script>location.href=”list.php”</script>’;
}
?>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt;
<html xmlns=”http://www.w3.org/1999/xhtml”&gt;
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>Registration Form</title>

<script type=”text/javascript” src=”validate.js”></script>
<script type=”text/javascript” src=”jquery-1.3.2.min.js”></script>
<link rel=”stylesheet” type=”text/css” href=”style.css” />

<script type=”text/javascript”>
$(document).ready(function(){

$(“#country”).change(function()
{
var country = $(‘#country’).val();
//alert(country);

if(country != 0)
{
$.ajax({
type: “POST”,
url: “getdata.php”,
data: {id:country}
}).done(function( result ) {
//alert(result)
$(“#div_state”).html(result);
});
}
});
});

</script>

</head>
<body>
<form name=”frmcontact” id=”frmpcontact” action=”” method=”post” onSubmit=”return validate();” enctype=”multipart/form-data” >
<!– The outter table to contain the form and the instruction panel –>
<table width=”650px” border=”0″ cellpadding=”2px” cellspacing=”1px” bgcolor=”#FFCC66″ align=”center” class=”tbl”>
<tr bgcolor=”#FFFFDD”>
<td width=”2px” bgcolor=”#FFCC66″></td>
<td width=”400px”>
<div class=”formHeading”>Registration Form</div>
<!– The inner table below is a container for form –>
<table width=”100%” border=”0″ cellpadding=”3px” class=”htmlForm” cellspacing=”0″>
<tr>
<td colspan=”2″>&nbsp;</td>
</tr>

<tr>
<td align=”left”>First Name</td>
<td width=”220px”><input type=”text” name=”f_name” id=”f_name” size=”32″ value=”<?=$result[1]?>” /></td>
</tr>
<tr>
<td align=”left”>Last Name</td>
<td><input type=”text” size=”32″ name=”l_name” id=”l_name” value=”<?=$result[2]?>”/></td>
</tr>
<tr>
<td align=”left”>Email</td>
<td><input type=”text” size=”32″ name=”email” id=”email” value=”<?=$result[3]?>”/></td>
</tr>
<tr>
<td align=”left”>Password</td>
<td><input type=”password” size=”32″ name=”password” id=”password” value=”<?=$result[4]?>”/></td>
</tr>
<tr>
<td align=”left”>City</td>
<td><input type=”text” size=”32″ name=”city” id=”city” value=”<?=$result[5]?>”/></td>
</tr>
<tr>
<td align=”left”>Country</td>
<td>
<select style=”width:150px” name=”country” id=”country”>
<option value=”0″> – Select Country -</option>
<?php
$c_result = mysql_query(“SELECT * FROM country”);
while($contry = mysql_fetch_array($c_result))
{
echo ‘<option value=”‘.$contry[‘id’].'”‘;
if($contry[‘id’] == $result[6]){ echo “selected=selected”; }
echo ‘>’.$contry[‘name’].'</option>’;
}
?>
</select>
</td>
</tr>

<tr>
<td align=”left”>State</td>
<td>
<div id=”div_state”>
<select style=”width:150px” name=”state” id=”state”>
<option> – Select State -</option>
<?php
$s_result = mysql_query(“SELECT * FROM state”);
while($state = mysql_fetch_array($s_result))
{
echo ‘<option value=”‘.$state[‘id’].'”‘;
if($state[‘id’] == $result[7]){ echo “selected=selected”; }
echo ‘>’.$state[‘name’].'</option>’;
}
?>
</select>
</div>
</td>

</tr>

<tr>
<td align=”left”>Zip</td>
<td><input type=”text” style=”width:150px” name=”zip” id=”zip” value=”<?=$result[8]?>”/></td>
</tr>
<tr>
<td align=”left”>Gender</td>
<td>
<input type=”radio” name=”gender” id=”gender_Male” value=”1″ <?php if($result[9]==1) echo ‘checked=”checked”‘; ?> />Male
<input type=”radio” name=”gender” id=”gender_Female” value=”0″ <?php if($result[9]==0) echo ‘checked=”checked”‘; ?>/>Female
</td>
</tr>

<tr>
<td align=”left”>Image</td>
<td> <input type=”file” style=”width:185px” name=”image” id=”image”/>
<input type=”hidden” name=”h_image” id=”h_image” value=”<?=$result[10];?>”>
</td>
</tr>

<tr>
<td colspan=”2″>&nbsp;</td>
</tr>

</table>
</td>
<td valign=”top”>
<ul class=”points”>
<li>First Name and Last Name are optional</li>
<li>Your email will be used as your login id</li>
<li>Password must be at least 5 characters long</li>
<li>Zip code must be a 5 digit numbber</li>
</ul>
</td>
<td width=”2px” bgcolor=”#FFCC66″></td>
</tr>
<tr bgcolor=”#FFCC66″>
<td>&nbsp;</td>
<td colspan=”2″>
<input type=”submit” value=”Update” name=”submit” id=”submit”/>
<input TYPE=”button” VALUE=”Cancle” onclick=”window.location.href=’list.php'”>
</td>
</tr>

</table>
</form>
</body>
</html>

getdata.php
_____________________________________________________________________________________________________
<?php
error_reporting(0);
require(‘db_conn.php’);

$id = $_POST[‘id’];
$sql = “SELECT * from state where country_id=”.$id;
$result = mysql_query($sql);

echo ‘<select style=”width:150px” name=”state” id=”state”>’;
echo ‘<option value=”0″>– Select state –</option>’;
while($row = mysql_fetch_array($result))
{
echo ‘<option value=”‘.$row[‘id’].'”>’.$row[‘name’].'</option>’;
}
echo ‘</select>’;
?>

index.php
________________________________________________________________________________________________________
<?php
error_reporting(0);
require(‘db_conn.php’);
if(isset($_REQUEST[‘submit’]) && $_REQUEST[‘submit’]==’Save’){
extract($_POST);
//echo ‘<pre>’; print_r($_REQUEST);
//echo ‘<pre>’; print_r($_POST);
//die();

// Image Upload start.
if(isset($_FILES[‘image’][‘name’])){
$dest = “uploads/”;
$image = $_FILES[‘image’][‘name’];
move_uploaded_file($_FILES[‘image’][‘tmp_name’],$dest.$image);
}
// End Image Upload.

echo $query = (“INSERT INTO registration (f_name, l_name, email, password, city, country, state, zip, gender, image)
VALUES (‘$f_name’, ‘$l_name’, ‘$email’, ‘$password’, ‘$city’, ‘$country’, ‘$state’, ‘$zip’, ‘$gender’,’$image’)”);
mysql_query($query);
echo ‘<script>location.href=”list.php”</script>’;
}
?>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt;
<html xmlns=”http://www.w3.org/1999/xhtml”&gt;
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>Registration Form</title>

<script type=”text/javascript” src=”validate.js”></script>
<script type=”text/javascript” src=”jquery-1.3.2.min.js”></script>
<link rel=”stylesheet” type=”text/css” href=”style.css” />

<script type=”text/javascript”>
$(document).ready(function(){

$(“#country”).change(function()
{
var country = $(‘#country’).val();
//alert(country);

if(country != 0)
{
$.ajax({
type: “POST”,
url: “getdata.php”,
data: {id:country}
}).done(function( result ) {
//alert(result)
$(“#div_state”).html(result);
});
}
});
});

</script>

</head>
<body>
<form name=”frmcontact” id=”frmpcontact” action=”” method=”post” onSubmit=”return validate();” enctype=”multipart/form-data” >
<!– The outter table to contain the form and the instruction panel –>
<table width=”650px” border=”0″ cellpadding=”2px” cellspacing=”1px” bgcolor=”#FFCC66″ align=”center” class=”tbl”>
<tr bgcolor=”#FFFFDD”>
<td width=”2px” bgcolor=”#FFCC66″></td>
<td width=”400px”>
<div class=”formHeading”>Registration Form</div>
<!– The inner table below is a container for form –>
<table width=”100%” border=”0″ cellpadding=”3px” class=”htmlForm” cellspacing=”0″>
<tr>
<td colspan=”2″>&nbsp;</td>
</tr>

<tr>
<td align=”left”>First Name</td>
<td width=”220px”><input type=”text” name=”f_name” id=”f_name” size=”32″ /></td>
</tr>
<tr>
<td align=”left”>Last Name</td>
<td><input type=”text” size=”32″ name=”l_name” id=”l_name”/></td>
</tr>
<tr>
<td align=”left”>Email</td>
<td><input type=”text” size=”32″ name=”email” id=”email”/></td>
</tr>
<tr>
<td align=”left”>Password</td>
<td><input type=”password” size=”32″ name=”password” id=”password”/></td>
</tr>
<tr>
<td align=”left”>City</td>
<td><input type=”text” size=”32″ name=”city” id=”city”/></td>
</tr>
<tr>
<td align=”left”>Country</td>
<td>
<select style=”width:150px” name=”country” id=”country”>
<option value=”0″> – Select Country -</option>
<?php
$result = mysql_query(“SELECT * FROM country”);

while($contry = mysql_fetch_array($result))
{
echo ‘<option value=”‘.$contry[‘id’].'”>’.$contry[‘name’].'</option>’;
}
?>
</select>
</td>
</tr>

<tr>
<td align=”left”>State</td>
<td>
<div id=”div_state”>
<select style=”width:150px” name=”state” id=”state”>
<option> – Select State -</option>
</select>
</div>
</td>
</tr>

<tr>
<td align=”left”>Zip</td>
<td><input type=”text” style=”width:150px” name=”zip” id=”zip”/></td>
</tr>
<tr>
<td align=”left”>Gender</td>
<td>
<input type=”radio” name=”gender” id=”gender_Male”/>Male
<input type=”radio” name=”gender” id=”gender_Female”/>Female
</td>
</tr>

<tr>
<td align=”left”>Image</td>
<td> <input type=”file” style=”width:185px” name=”image” id=”image”/>
</td>
</tr>

<tr>
<td colspan=”2″>&nbsp;</td>
</tr>

</table>
</td>
<td valign=”top”>
<ul class=”points”>
<li>First Name and Last Name are optional</li>
<li>Your email will be used as your login id</li>
<li>Password must be at least 5 characters long</li>
<li>Zip code must be a 5 digit numbber</li>
</ul>
</td>
<td width=”2px” bgcolor=”#FFCC66″></td>
</tr>
<tr bgcolor=”#FFCC66″>
<td>&nbsp;</td>
<td colspan=”2″>
<input type=”submit” value=”Save” name=”submit” id=”submit”/>
<input type=”reset” value=”Reset” />
<input TYPE=”button” VALUE=”List view” onclick=”window.location.href=’list.php'”>
</td>
</tr>

</table>
</form>
</body>
</html>

list.php
___________________________________________________________________________________________________
<?php
require(‘db_conn.php’);
$result = mysql_query(“SELECT * FROM registration”);

if(isset($_REQUEST[‘action’]) && $_REQUEST[‘action’]==’delete’){

mysql_query(“DELETE FROM registration WHERE id = “.$_REQUEST[‘id’]);
}
?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”&gt;
<html xmlns=”http://www.w3.org/1999/xhtml”&gt;
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>Registration Form</title>
<script type=”text/javascript” src=”validate.js”></script>
<link rel=”stylesheet” type=”text/css” href=”style.css” />

<script>
function confirm_delete(id) {

if(confirm(“Are you sure you want to delete this Page?”)) {
document.location.href = “list.php?action=delete&id=”+id;
}
return false;
}
</script>

</head>
<body>
<form name=”frmcontact” id=”frmpcontact” action=”#” method=”post” onSubmit=”return validate();” enctype=”multipart/form-data” >
<!– The outter table to contain the form and the instruction panel –>
<table width=”800px” border=”0″ cellpadding=”2px” cellspacing=”1px” bgcolor=”#FFCC66″ align=”center” class=”tbl”>
<tr bgcolor=”#FFFFDD”>
<td width=”2px” bgcolor=”#FFCC66″></td>
<td width=”400px”>
<div class=”formHeading”>Register List</div>
<!– The inner table below is a container for form –>
<table width=”100%” border=”0″ cellpadding=”3px” class=”htmlForm” cellspacing=”0″>
<tr>
<td colspan=”8″>&nbsp;</td>
</tr>

<tr>
<td align=”left”><b>First Name</b></td>
<td align=”left”><b>Last Name</b></td>
<td align=”left”><b>E-Mail</b></td>
<td align=”left”><b>Gender</b></td>
<td align=”left”><b>Country</b></td>
<td align=”left”><b>State</b></td>
<td align=”left”><b>City</b></td>
<td align=”left”><b>Image</b></td>
<td align=”left”><b>Edit</b></td>
<td align=”left”><b>Delete</b></td>
</tr>

<?php
while($row = mysql_fetch_array($result))
{
//echo ‘<pre>’; print_r($row);
echo ‘<tr> <td align=”left”>’.$row[‘f_name’].'</td>’;
echo ‘<td align=”left”>’.$row[‘l_name’].'</td>’;
echo ‘<td align=”left”>’.$row[’email’].'</td>’;

if($row[‘gender’]==0)
echo ‘<td align=”left”>Female</td>’;
else
echo ‘<td align=”left”>Male</td>’;

$qry = “SELECT * from country where id = “.$row[‘country’];
$qry = mysql_query($qry);
$contry = mysql_fetch_row($qry);
echo ‘<td align=”left”>’.$contry[1].'</td>’;

$s_qry = “SELECT * from state where id = “.$row[‘state’];
$s_qry = mysql_query($s_qry);
$state = mysql_fetch_row($s_qry);
echo ‘<td align=”left”>’.$state[2].'</td>’;

if($row[‘image’])
echo “<td align=’center’><img src=’uploads/”.$row[‘image’].”‘ width=’50’ height=’50’/></td>”;
else
echo ‘<td align=”center”>-</td>’;

echo ‘<td align=”left”>’.$row[‘city’].'</td>’;
echo ‘<td align=”left”><a href=”edit.php?id=’.$row[‘id’].'”>Edit</a></td>’;
echo ‘<td align=”left”><a href=”javascript:;” onclick=”confirm_delete(‘.$row[‘id’].’);”>Delete</a></td></tr>’;

}
?>

<tr>
<td colspan=”8″>&nbsp;</td>
</tr>

</table>
</td>
<td width=”2px” bgcolor=”#FFCC66″></td>
</tr>

<tr bgcolor=”#FFCC66″>
<td>&nbsp;</td>
<td colspan=”2″>
<input TYPE=”button” VALUE=”Register Now” onclick=”window.location.href=’index.php'”>
</td>
</tr>

</table>
</form>
</body>
</html>

style.css
________________________________________________________________________________________________________
.htmlForm td{
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
color:#CC3300;
border-bottom:1px #EAE3C8 solid;
}
.htmlForm input,select{
border:1px #BDB597 solid;
font-family:tahoma;
font-size:12px;
padding:2px;
}
.points{
font-family:tahoma;
font-size:11px;
color:#CC3300;
padding-left:20px;
padding-top:20px;
}
.points li{
padding-top:5px;
}
.formHeading{
font-family:Arial, Helvetica, sans-serif;
font-size:16px;
font-weight:bold;
color:#CC3300;
padding:10px;
}
.tbl{
padding-top:15px;
}
validate.js
_____________________________________________________________________________________________________
function validate()
{
if(trim(document.getElementById(‘f_name’).value) == ”)
{
alert(‘Please enter first name.’);
document.getElementById(‘f_name’).value=”;
document.getElementById(‘f_name’).focus();
return false;
}
if(trim(document.getElementById(‘l_name’).value)==”)
{
alert(‘Please enter last name.’);
document.getElementById(‘l_name’).value=”;
document.getElementById(‘l_name’).focus();
return false;
}

if(trim(document.getElementById(’email’).value)==””)
{
alert(“Please enter Email Id.”);
document.getElementById(’email’).value=”;
document.getElementById(’email’).focus();
return false;
}
if(!checkemail(document.getElementById(’email’).value))
{
alert(“Please enter valid Email ID.”);
document.getElementById(’email’).value=”;
document.getElementById(’email’).focus();
return false;
}

if(trim(document.getElementById(‘password’).value)==”)
{
alert(‘Please enter last name.’);
document.getElementById(‘password’).value=”;
document.getElementById(‘password’).focus();
return false;
}

if((document.getElementById(‘gender_Male’).checked) || (document.getElementById(‘gender_Female’).checked)) {

}else{
alert(‘Please select gender.’);
document.getElementById(‘gender_Male’).focus();
return false;
}

var fup = document.getElementById(‘image’);
var fileName = fup.value;
var ext = fileName.substring(fileName.lastIndexOf(‘.’) + 1);
if( ext == “gif” || ext == “GIF”
|| ext == “jpeg” || ext == “JPEG”
|| ext == “jpg” || ext == “JPG”
|| ext == “png” || ext == “PNG”
|| ext == “bmp” || ext == “BMP”)
{
return true;
}
else
{
alert(“Upload Gif,bmp,png or Jpg images only”);
fup.focus();
return false;
}

document.getElementById(‘h_save’).value =’T’;
return true;
}

function trim (str, charlist) {
var whitespace, l = 0,
i = 0;
str += ”;

if (!charlist) {
// default list
whitespace = ” \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000″;
} else {
// preg_quote custom list
charlist += ”;
whitespace = charlist.replace(/([\[\]\(\)\.\?\/\*\{\}\+\$\^\:])/g, ‘$1’);
}

l = str.length;
for (i = 0; i < l; i++) {
if (whitespace.indexOf(str.charAt(i)) === -1) {
str = str.substring(i);
break;
}
}

l = str.length;
for (i = l – 1; i >= 0; i–) {
if (whitespace.indexOf(str.charAt(i)) === -1) {
str = str.substring(0, i + 1);
break;
}
}

return whitespace.indexOf(str.charAt(0)) === -1 ? str : ”;
}

function checkemail(str)
{
var testresults;

var filter=/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i;

if (filter.test(str))
testresults=true
else
testresults=false

return (testresults)
}

function KeycheckOnlyPhonenumber(e)
{
var _dom = 0;
//var stripped = fld.value.replace(/[\(\)\.\-\ ]/g, ”);

_dom=document.all?3:(document.getElementById?1:(document.layers?2:0));
if(document.all) e=window.event; // for IE
var ch=”;
var KeyID = ”;
//alert(_dom);
if(_dom==2){ // for NN4
//alert(e.which);
if(e.which>0) ch='(‘+String.fromCharCode(e.which)+’)’;
KeyID=e.which;
}
else
{
if(_dom==3){ // for IE
KeyID = (window.event) ? event.keyCode : e.which;
}
else { // for Mozilla
//alert(‘Mozilla:’ + e.charCode);
if(e.charCode>0) ch='(‘+String.fromCharCode(e.charCode)+’)’;
KeyID=e.charCode;
}
}
if((KeyID >= 65 && KeyID <= 90) || (KeyID >= 97 && KeyID <= 122) || (KeyID >= 33 && KeyID <= 39) || (KeyID >= 46 && KeyID <= 47) || (KeyID >= 58 && KeyID <= 64) || (KeyID >= 91 && KeyID <= 96) || (KeyID >= 123 && KeyID <= 126))
{
return false;
}

// if((KeyID >= 65 && KeyID <= 90) || (KeyID >= 97 && KeyID <= 122) || (KeyID >= 33 && KeyID <= 39) || (KeyID >= 42 && KeyID <= 44) || (KeyID >= 46 && KeyID <= 47) || (KeyID >= 58 && KeyID <= 64) || (KeyID >= 91 && KeyID <= 96) || (KeyID >= 123 && KeyID <= 126))
// {
// return false;
// }
return true;
}

function LimitAttach_Pdf(file,id)
{
var imgpath = document.getElementById(id).value;

if(imgpath != “”)
{

// code to get File Extension..
var arr1 = new Array;
arr1 = imgpath.split(“\\”);
var len = arr1.length;
var img1 = arr1[len-1];
var filext = img1.substring(img1.lastIndexOf(“.”)+1);
// Checking Extension

if(filext == “pdf” || filext == “zip” || filext == “rar” || filext == “doc” || filext == “docx” )
{
return true;
}
else
{
document.getElementById(id).value = “”;
return false;

}
}
}

 

Comments
2 Responses to “DB Example”
  1. X-Man says:

    X-man Good Work Dude……..Cont……….& Enjoy.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: