Codeigniter: Retrieving data from multiple tables and displaying results
Posted
by Craig Ward
on Stack Overflow
See other posts from Stack Overflow
or by Craig Ward
Published on 2010-06-08T12:10:16Z
Indexed on
2010/06/08
12:22 UTC
Read the original article
Hit count: 258
codeigniter
Hi,
I am developing my first big application using codeigniter and need a little help as I am fairly new to it all. I know how to get records out of the DB and display them, but I now have to get results from two tables and display them. I pass $data to the view, it works fine for $data['prop'] but I can't get the rest.
$data['prop'] = $this->ManageProperty_model->get_property_details($p_id);
$data['img'] = $this->ManageProperty_model->get_property_images($p_id);
$this->load->model('ManageBranch_model');
$data['branch'] = $this->ManageBranch_model->get_branch_details($p_id);
I usually echo out results like so:
<?php foreach ($prop as $p) : ?>
Even if there is only 1 row being returned as I am not sure of another way.do I need a foreach for img and branch?
<?php echo $p->ID; ?>
<?php endforeach; ?>
© Stack Overflow or respective owner