I am trying to display results from a database where the results are contained in three tables. How do I echo out the results?

$p-> works, but $img-> or $branch-> doesn't. What am I doing wrong?

Example code is below 

Sample controller:

> 
> $p\_id = $this->uri->segment(3);
> 
> 
> $this->load->model('One\_model');  
> 
>  $data['prop'] = $this->One\_model->get\_details($p\_id);  
> 
>  $data['img'] = $this->One->get\_images($p\_id); 
> 
> 
> $this->load->model('Two\_model');  
> 
>  $data['branch'] = $this->Two\_model->get\_details($p\_id); 
> 
> 
> $this->load->view('a\_test\_view', $data); 
> 
> 
> 

A Sample View

`<?php foreach ($property as $p):?>`  

`<p><?php echo $p->SUMMARY; ?></p>`  

`<p>We have <?php echo "$img->num_photos"; ?> photos</p>`  

`<p>Branch is <?php echo $branch->name; ?>. Telephone <?php echo $branch->tel; ?></p>`  

`<ul>`  

`<li><?php echo $p->FEATURE1; ?></li>`  

`<li><?php echo $p->FEATURE2; ?></li>`  

`<li><?php echo $p->FEATURE3; ?></li>`  

`<li><?php echo $p->FEATURE4; ?></li>`  

`<li><?php echo $p->FEATURE5; ?></li>`  

`<li><?php echo $p->FEATURE6; ?></li>`  

`<li><?php echo $p->FEATURE7; ?></li>`  

`<li><?php echo $p->FEATURE8; ?></li>`  

`<li><?php echo $p->FEATURE9; ?></li>`  

`<li><?php echo $p->FEATURE10; ?></li>`  

`</ul>`  

`<?php endforeach; ?>`