Welcome Guest, Not a member yet? Register   Sign In
Problem in display (view)
#1

[eluser]johnmiller[/eluser]
Hey...

I have a table called 'users' with fields 'name, address'.

There are 100 records in this table.

I need to display all the 100 records in the 'view'.

But I am getting only one record(first record).

How to write the view which displays all the 100 records?

Can you please help me?

The below given are the model and controller

Model (blogmodel.php)

Code:
<?php

class Blogmodel extends  Model {

function select_entries()
{
    $this->db->select('name, address');
    $query = $this->db->get('users');
    return $query->row_array();

}
}
?>

Controller (blog.php)

Code:
<?php

class Blog Extends Controller {

function index()
{  
    $this->load->model('blogmodel');
    $data['query'] = $this->blogmodel->select_entries();
    $this->load->view('blogview', $data);
}
}

?>
#2

[eluser]jcopling[/eluser]
I believe that you are wanting the function result_array() rather than row_array().

The row() and row_array() functions simply return the first result.
#3

[eluser]cyr0715[/eluser]
http://ellislab.com/codeigniter/user-gui...sults.html




Theme © iAndrew 2016 - Forum software by © MyBB