Saturday, 15 March 2014

Inserting Data into MySql Database Using PHP

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

<body>
<?php
include_once("../Connection.php");
$c = new Connectionclass();
$c->connect();
$query="select * from area_master where area_name='".$_REQUEST["txtareaname"]."' and city_id=".$_REQUEST["drpcity"];
$c->calldata($query);
$no=mysql_num_rows($c->res);

if($no>0)
{
    echo"<script>alert('Duplicate');document.location='areadetail.php';</script>";
}
else
{
  

$query="insert into area_master(area_name,city_id) values('".$_REQUEST["txtareaname"]."',".$_REQUEST["drpcity"].")";
$c->in_up_de($query);
echo"<script>alert('Data Saved');document.location='areadetail.php';</script>";
}
?>
</body>
</html>

0 comments:

Post a Comment

Followers