[eluser]Zeeshan Rasool[/eluser]
Here , two situations arrive ,
When you are using like this in controller. You're getting record directly in controller such as..
Code:
1- $data['questions'] = $this->db->get('questions');
Then record will be accessed in the view with this :
Code:
foreach($questions->result() as $rec){echo $rec->name;}?>
But if you're using model in middle which is models work to do, such as
in controller:
Code:
2- $data['questions'] = $this->model_name->func_name();
and in model:
Code:
func_name()
{
$query = $this->db->get('questions');
/// Here you will return query record like this:
retutn $query->result();
}
Now in the last in view we will get records :
Code:
foreach($questions as $rec)
{
echo $rec->name;
}?>
Hope it will help.
Cheers