public function save() { // yo thau ma requirement save huna aaucha // yei bata feri "index.php" ma falne jun chai profile ma jancha $req = new Requirement(); if (isset($_POST['title'])) { $req->setTitle($_POST['title']); } else { $req->setTitle(""); } if (isset($_POST['date'])) { $req->setDate($_POST['date']); } else { $req->setDate("01-01-2001"); } if (isset($_POST['details'])) { $req->setDescription($_POST['details']); } else { $req->setDescription(""); } $req->setStatus(1); $req->setOrgname(""); $this->requirement_repository->insert($req); }
public function get_by_id($requirement_id) { $this->database->connect(); $sql = "SELECT * FROM welfrequirement WHERE welfreq_id=?"; //prepare the statement $statement = $this->database->initialize($sql); //Bind the parameters $statement->bind_param("i", $requirement_id); //Execute the above statement $statement->execute(); //Bind the result $statement->bind_result($welfreq_id, $title, $description, $end_date, $status, $org_name, $welf_id); $req = NULL; while ($statement->fetch()) { $req = new Requirement(); $req->setRequirementId($welfreq_id); $req->setTitle($title); $req->setDescription($description); $req->setDate($end_date); $req->setStatus($status); $req->setOrgname($org_name); $req->setWelfId($welf_id); } //Close Connection $this->database->close(); return $req; }