I have this three database table
vedd_plan_task
-task_id, -task_name,
tbl_plan
-plan_id, -plan_title, -plan_price, -plan_desc,
plan_task_mapping
-task_mapp_id, -plan_id, -task_id,
The Flow of process is like -- i am creating a edit/update/delete system of this data. i create a form to insert plan data,i fetch the task name dynamically on that page and the insert the data in to database with mapping technique. means while inserting i mapped the Plan_id and Task_id in mapping table.
I successfully inserted it. and display in my view table. now i have to edit this detail. but first i have to show this detail in my view (like plan detail in input box as plan the selected task in check box)
Now i have to fetch this data for edit them ... i can't fetch the proper way as.. Means can't get proper task_name as plan_id. Help me please...
"plan_title | plan_price | plan_desc | task_name "
This is the plan Model
public function getPlanById($planId)
{
$this->db->where('plan_id', $planId);
$query = $this->db->get('tbl_plan');
return $query->result();
}
public function getPlanAndTaskMappingByPlanId($planId)
{
$this->db->where('plan_id', $planId);
$query = $this->db->get('plan_task_mapping');
return $query->result();
}
function getAllVeddingTask()
{
$query = $this->db->get('vedd_plan_task');
return $query->result();
}
This is the controller
public function editPlanData($planId)
{
$data['veddingPlanData'] = $this->PlanModel->getPlanById($planId);
$data['veddingPlanTaskMappingData'] = $this->PlanModel->getPlanAndTaskMappingByPlanId($planId);
$data['allVedingTasks'] = $this->VeddingTaskModel->getAllVeddingTask();
$this->load->view('plan_update', $data);
}
I dump data successfully... in my view now i have to show only that task which is selected for plan.. means the i have to show task_name as plan_id. threw mapping tale
<?php var_dump($veddingPlanData); ?>
<?php var_dump($veddingPlanTaskMappingData); ?>
<?php var_dump($allVedingTasks); ?>
this is my view
now help me to fetch that plan with the specific task_name as check box and plan data in input box.. hear in view i comment the dump part .. i dump it successfully. so i just want to edit that data which is called on product id.. as product id the data come from mapping and then the task_name came form task table.