Welcome Guest, Not a member yet? Register   Sign In
Returning number of rows
#1

[eluser]Michal1[/eluser]
Hi I am probably having a really stupid problem. I am trying to echo number of returned rows but I am doing something wrong.

I have classic model (no need to show it) for getting data from database table called "data". Then a controller and inside I have

Code:
public function index()
        {
    $data=array();
if($query=$this->site_model->get_data())
            {
    $data['backlinks']=$query;
            }

$this->load->view('site_view',$data);

}

And then in view I want to echo number of rows so I am trying something like

Code:
<?php foreach($backlinks as $row):?>

<?php echo $row->backlinks->num_row(); ?>

<?php endforeach; ?>

But of course I get an error. Does anybody has any idea? Thank you




Theme © iAndrew 2016 - Forum software by © MyBB