Search Results

Search found 1 results on 1 pages for 'user2167174'.

Page 1/1 | 1 

  • Codeigniter php activerecord orm limit and offset

    - by user2167174
    I am a bit stuck with this problem I have in phpactiverecord. What I am trying to do is a pagination so I need to limit and offset the query results. I am accessing all of the user posts like so: $user-post; How can I query this to limit and offset the results? Thanx in advance. Code: public function office() { if (!$this->session->userdata('username')) { redirect(base_url()); } $data = array(); $data['posts'] = []; $user = User::find('first', array('id' => $this->session->userdata('id'))); if ($user != null) { if ($user->post != null) { foreach ($user->post as $post) { $posts = array($post->name, $post->description, $post->date,'<a href="'.base_url().'Posts/edit/'.$post->id.'">Edit</a> <br /><a href="'.base_url().'Posts/delete/'.$post->id.'">Delete</a>'); array_push($data['posts'], $posts); } $this->table->set_heading('Name', 'Description', 'Date', '<a href="'.base_url().'Posts/create">+Add</a>'); $tmpl = array('table_open' => '<table class="table table-stripped table-bordered user-posts">'); $this->table->set_template($tmpl); $data['table'] = $this->table->generate($data['posts']); } $this->load->view('template/header.php'); $this->load->view('Users/office.php', $data); $this->load->view('template/footer.php'); } else { redirect(base_url()); } }

    Read the article

1