public function get_by_id($project_id) { $proj = null; $this->database->connect(); $sql = "SELECT * FROM projects WHERE project_id=?"; //prepare the statement $statement = $this->database->initialize($sql); //Bind the parameters $statement->bind_param("i", $project_id); //Execute the above statement $statement->execute(); //Bind the result $statement->bind_result($project_id, $start_date, $end_date, $title, $objectives, $short_desc, $location, $budget, $volunteer, $banner_image, $project_proposal, $video_url, $detail, $status, $u_id); while ($statement->fetch()) { $proj = new Project(); $proj->setProject_id($project_id); $proj->setStart_date($start_date); $proj->setEnd_date($end_date); $proj->setTitle($title); $proj->setObjectives($objectives); $proj->setShortdes($short_desc); $proj->setLocation($location); $proj->setBudget($budget); $proj->setVolunteer($volunteer); $proj->setBanner_image($banner_image); $proj->setProject_proposal($project_proposal); $proj->setVideourl($video_url); $proj->setDetail($detail); $proj->setStatus($status); $proj->setUid($u_id); } //Close Connection $this->database->close(); return $proj; }