I have posted image in database, and i got that image also, but i want to replace the image using php code can any one help me this is my code
<?php
require("../db.php");
$id =$_REQUEST['id'];
$result = mysql_query("SELECT * FROM doctors WHERE id = '$id'");
$test = mysql_fetch_array($result);
if (!$result)
die("Error: Data not found..");
}
$name=$test['doc_name'] ;
$hospital=$test['hosp_name'] ;
$description=$test['hosp_desc'];
$facilities=$test['hosp_facilities'] ;
$mobile=$test['doc_mobileno'] ;
$email=$test['doc_emailid'] ;
$address=$test['doc_address'] ;
$Speciality=$test['speciality'] ;
$city=$test['doc_city'] ;
$map=$test['doc_iframe'] ;
$img=$test['hosp_pic'];
if(isset($_POST['save']))
{
$name_save = $_POST['doc_name'];
$hospital_save = $_POST['hosp_name'];
$description_save = $_POST['hosp_desc'];
$facilities_save = $_POST['hosp_facilities'];
$mobile_save = $_POST['doc_mobileno'];
$email_save = $_POST['doc_emailid'];
$address_save = $_POST['doc_address'];
$Speciality_save = $_POST['speciality'];
$city_save = $_POST['doc_city'];
$map_save = $_POST['doc_iframe'];
$img_save=$_FILES['hosp_pic'];
mysql_query("UPDATE doctors SET doc_name ='$name_save', hosp_name ='$hospital_save',
hosp_desc ='$description_save',hosp_facilities='$facilities_save',doc_mobileno='$mobile_save',
doc_emailid='$email_save',doc_address='$address_save',speciality='$Speciality_save',doc_city='$city_save',
doc_iframe='$map_save',hosp_pic='$img_save'
WHERE id = '$id'")
or die(mysql_error());
header("Location:add-doctor.php");
}
mysql_close($conn);
?>
<!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>Untitled Document</title>
</head>
<body>
<form method="post">
<table>
<tr>
<td>Name:</td>
<td><input type="text" name="doc_name" value="<?php echo $name ?>"/></td>
</tr>
<tr>
<td>Hospital Name</td>
<td><input type="text" name="hosp_name" value="<?php echo $hospital ?>"/></td>
</tr>
<tr>
<td>Description</td>
<td><input type="text" name="hosp_desc" value="<?php echo $description ?>"/></td>
</tr>
<tr>
<td>Facilities</td>
<td><input type="text" name="hosp_facilities" value="<?php echo $facilities ?>"/></td>
</tr>
<tr>
<td>Hospital Phone Number</td>
<td><input type="text" name="doc_mobileno" value="<?php echo $mobile ?>"/></td>
</tr>
<tr>
<td>Email</td>
<td><input type="text" name="doc_emailid" value="<?php echo $email ?>"/></td>
</tr>
<tr>
<td>Hospital Address</td>
<td><input type="text" name="doc_address" value="<?php echo $address ?>"/></td>
</tr>
<tr>
<td>Speciality</td>
<td><input type="text" name="speciality" value="<?php echo $Speciality ?>"/></td>
</tr>
<tr>
<td>City</td>
<td><input type="text" name="doc_city" value="<?php echo $city ?>"/></td>
</tr>
<tr>
<td>Map</td>
<td><input type="text" name="doc_iframe" value="<?php echo $map ?>"/></td>
</tr>
<tr>
<td>Logo</td>
<td><input type="file" name="hosp_pic" value=""/><?php echo $img ?></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="save" value="save" /></td>
</tr>
</table>
</body>
</html>