I'm unable to view data from my database using these codes. Just echoing NO Records Returned
controller :
public function get_task()
{
$data = array();
if( $query = $this->model_users->getTask()){
$data ['records'] = $query ;
}
$this->load->view('Reg_Login/members', $data);
}
members.php :
<?php if(isset($records)) : foreach($records as $row): ?>
<tr>
<td><?php echo $row->tname ;?></td>
<td><?php echo $row->time; ?> </td>
</tr>
<?php endforeach; ?>
<?php else : ?>
<h2>No Records Returned</h2>
<?php endif; ?>
model_users :
public function getTask()
{
$query = $this->db->get('tasks');
return $query->result();
}
<?php else :?>were executed which is No Records Returned. Check my view file's last para.:with else statement. use{for yourifelseblock. and add$this->output->enable_profiler(TRUE);on top of your method and check what query is being executed.$this->output->enable_profiler(TRUE);It helped me out to find what query was executing and I found that I didn't invoke the method properly. Now my problem is solved. Thank you guys for your efforts ! :)