public function saveUser(DUser $client) { $birth = $client->getBirth()->format("Y-m-d"); $status = intval($client->getStatus()); $n = $client->getName(); $s = $client->getSurname(); $SSN = $client->getSSN(); $p = $client->getPhone(); $m = $client->getMail(); $pass = $client->getPassword(); $type = $client->getType(); $code = $client->getCode(); $already_in = $this->loadClient($SSN); if ($already_in) { $query = "UPDATE person SET MAIL = '{$m}', PASSWORD ='******', TYPE = '{$type}', CODE = '{$code}'\n\t\t\tWHERE SSN = '{$SSN}';"; } else { $query = "INSERT INTO person(name, surname, SSN, phone, mail, birth, password, status,code, type) \n\t\t\tVALUES ('{$n}','{$s}','{$SSN}','{$p}','{$m}','{$birth}','{$pass}',{$status},'{$code}',{$type});"; } $temp = $this->db->query($query); if (!$temp) { throw new Exception("Query Failed saveClient FUser"); } else { return true; } }