public function store() { $db = new Database(); if ($this->cnt == 0) { $db->sendQuery("INSERT INTO `employees`(`name`, `surname`, `familyName`, `personalId`, `position`) VALUES ('{$this->name}','{$this->surname}','{$this->familyName}','{$this->personalId}','{$this->position}')"); } else { $db->sendQuery("UPDATE `employees` SET `name`='{$this->name}',`surname`='{$this->surname}',`familyName`='{$this->familyName}',`position`='{$this->position}' WHERE `personalId`='{$this->personalId}'"); } $this->cnt++; }