[eluser]pejo[/eluser]
Kind of a newby question and maybe more PHP than codeigniter, but here goes. I'm trying to access a value (pubid) returned by model so I can pass it to another model function, this is all inside my controller. Don't know how to reference that $data['pubdates'] object here? Have no problem in view using ($pubdates) but problem is here in controller not sure how to access value in the pubdates array, getting index not defined?
Code:
// controller function
function search($pd)
{
$this->load->model('Pages_model');
$data['pubdates'] = $this->Pages_model->GetPubdates(array('pubdate' => $pd));
$data['pages'] = $this->Pages_model->GetPages(array('pubid' => $data['pubdates']['pubid']));
$this->load->view('pubs/pubdates',$data);
}
class Pages_model extends Model {
function __construct()
{
parent::__construct();
}
function GetPubdates($options = array())
{
if(isset($options['pubdate']))
{
$this->db->where('pubdate', $options['pubdate']);
$query = $this->db->get("pubdates");
return $query->result();
}
}
function GetPages($options = array())
{
if(isset($options['pubid']))
{
$this->db->where('pubid', $options['pubid']);
$query = $this->db->get("pages");
return $query->result();
}
}
}
BTW this is a master detail scenario, I'm trying to pass pubid from Pubdates to the GetPages function in model.
Thanks.