<?php
include '../../conn.php';

$doctorid=$_POST['id'];
$name=$_POST['name'];
$phone=$_POST['phone'];
$email=$_POST['email']; 

$type=$_POST['type'];
$degree=$_POST['degree'];
$experience=$_POST['experience'];
$homevisit=$_POST['homevisit'];

$clinicvisit=$_POST['clinicvisit'];
$nightvisit=$_POST['nightcharge'];
$flatfee=$_POST['flatfee'];
$perkmrate=$_POST['perkmrate'];
$raduis=$_POST['raduis'];
$workingtime=$_POST['workingtime'];
$sundaytime=$_POST['sundaytime'];
$address=$_POST['address']; 

if($_FILES['image']['name'] != '0')  {

$valid_extensions = array('jpeg', 'jpg', 'png', 'gif', 'bmp' , 'pdf' , 'doc' , 'ppt'); // valid extensions
$path = 'images/user/'; // upload directory

$img = $_FILES['image']['name'];
$tmp = $_FILES['image']['tmp_name'];
// get uploaded file's extension
$ext = strtolower(pathinfo($img, PATHINFO_EXTENSION));
// can upload same image using rand function
$final_image = rand(1000,1000000).$img;
// check's valid format
		if(in_array($ext, $valid_extensions)) 
		{ 
		$path = $path.strtolower($final_image); 
		move_uploaded_file($tmp,'../../'.$path);
		}
$path=$baseimage.$path;

$update = $con->query("update `doctors` set `name`='$name', `image`='$path', `phone`='$phone', `type`='$type', `qualification`='$degree', `experience`='$experience', `homeVisit`='$homevisit', `clinicVisit`='$clinicvisit', `nightCharge`='$nightvisit', `flatFee`='$flatfee', `perkmrate`='$perkmrate', `raduis`='$raduis', `workingTime`='$workingtime', `sundaytiming`='$sundaytime',`address`='$address' where id='$doctorid'");
}
else{
$update = $con->query("update `doctors` set `name`='$name',  `phone`='$phone', `type`='$type', `qualification`='$degree', `experience`='$experience', `homeVisit`='$homevisit', `clinicVisit`='$clinicvisit', `nightCharge`='$nightvisit', `flatFee`='$flatfee', `perkmrate`='$perkmrate', `raduis`='$raduis', `workingTime`='$workingtime', `sundaytiming`='$sundaytime',`address`='$address' where id='$doctorid'");
   
}

if($update > 0)
{ 
  echo '101';
}
else
{
    echo '404';
}

?>