Welcome Guest, Not a member yet? Register   Sign In
How to view particular data from different table in database into one table
#1

[eluser]Unknown[/eluser]
Hi. I am a newbie with Codeigniter. I would like to know how to view data from different table. Based on my attachments, ci1 is the first page which user will click on the Package Name and goes to another page which is ci2. The data in the table in ci2 comes from different table in the database. My question is, how to view the particular data clicked by user? What I already did is when user click the Package Name it will show all data which is not related. Thank you in advanced for your answers.
#2

[eluser]kamikaz[/eluser]
Add a parameter in the url of the package link like he id of the package (or something that can identify a package).
then on the controller, get this parameter and select all the values related to the parameter id.

$this->input->get() for gathering the parameter in the url.
#3

[eluser]Unknown[/eluser]
thank you for your answer however it didn't work and I'm not sure whether I put it wrong or not. Here is my code in view:

Code:
<a href="&lt;?php echo base_url().'index.php/nossmgmt/listpackage'.$id['id']; ?&gt;&lt;?php echo $id;?&gt;">
&lt;?php echo strtoupper(getpackagename($rsp['id'])); ?&gt;</a>


and here in controller:

Code:
function listpackage()
{
$this->load->helper(array('form', 'url'));
  
   $this->load->model('listpackage_m');
   $selectedmenu ='10';
   $data['nossid'] = '';
  
   $data['spackagename'] = $this->input->get('id');
   //$data['snosstitle'] = $this->input->post('nosstitle');
   $data['sdevelopby'] = $this->input->post('developby');
   $data['sdevelopmentstatus'] = $this->input->post('developmentstatus');
   $data['ssectorname'] = $this->input->post('sectorname');
   $data['type'] = $this->input->post('type');
   $data['menu_list'] = $this->menu->showLeftNav('');
   $this->load->setLayout('listpackage',$data);
   $this->load->viewLayout($selectedmenu,$data);



}
kindly guide me and thanks again
#4

[eluser]kamikaz[/eluser]
Your <a> tag should be:

Code:
<a href="&lt;?php echo base_url().'index.php/nossmgmt/listpackage?id='.$id['id']; ?&gt;">
&lt;?php echo strtoupper(getpackagename($rsp['id'])); ?&gt;</a>




Theme © iAndrew 2016 - Forum software by © MyBB