コード例 #1
0
 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;
 }