include("conectar.php");
$data = json_decode($_POST['contatos']);
$surname= $data->surname;
$fname = $data->fname;
$lname = $data->lname;
$DOB = $data->DOB;
$phone = $data->phone;
$resurs = $data->resurs;
$otdel = $data->otdel;
......
$query = sprintf("UPDATE user SET surname = '%s', fname = '%s', lname = '%s',DOB = '%s',phone = '%s',resurs = '%s',otdel = '%s',........WHERE id=%d",
mysql_real_escape_string($surname),
mysql_real_escape_string($fname),
mysql_real_escape_string($lname),
mysql_real_escape_string($DOB),
mysql_real_escape_string($phone),
mysql_real_escape_string($resurs),
mysql_real_escape_string($otdel),
...........
$rs = mysql_query($query);
echo json_encode(array(
"success" => mysql_errno() == 0,
"contatos" => array(
"id" => $id,
"surname" => $surname,
"fname" => $fname,
"lname" => $lname,
"DOB" => $DOB,
"phone" => $phone,
"resurs" => $resurs,
"otdel" => $otdel,
................