<?php include("../cn.php");
$id = $_REQUEST["id"];

$fname = $_REQUEST["fname"];
$username = $_REQUEST["username"];
$password = $_REQUEST["password"];
$email = $_REQUEST["email"];
$address = $_REQUEST["address"];
$phone = $_REQUEST["phone"];
$representative = $_REQUEST["representative"];

$img_name = date("Ymdis");
$photo=($_FILES["photo"]["name"]!="")?"../admin/users/user_".$img_name.".".pathinfo($_FILES['photo']['name'], PATHINFO_EXTENSION):"";
if($_FILES["photo"]["name"]!="")
{
    move_uploaded_file($_FILES["photo"]["tmp_name"],"../".$photo);
	$imgsql = "Image='$photo',";

}
mysqli_query($connect, "UPDATE `users` set $imgsql `FullName`='$fname', `Username`='$username',`Password` = '$password', 
`Email`='$email', `Address`='$address', `Phone`='$phone',`Representative`='$representative' where Id='$id'");

header("location:../users.php");

?>