11-11-2009, 10:25 PM
|
#1 (permalink)
|
|
The Acquainted
Join Date: Oct 2007
Location: Newcastle, UK
Posts: 113
Thanks: 3
|
Edit post with CodeIgniter
I'm playing with CodeIgniter for the first time and I've managed to confuse myself. I've made a very simple blog script which I can add posts with, now I want to make an edit post page.
My controller looks like:
PHP Code:
function edit_posts()
{
$this->load->helper('form');
$this->load->model('posts_table');
$data['posts'] = $this->posts_table->edit_post();
$this->load->view('edit_posts', $data);
}
And the model:
PHP Code:
function edit_post()
{
$this->db->where('id', $this->uri->segment(3));
$query = $this->db->get('posts');
}
How do I display the stuff it gets from the database in my view? All the examples I can find use loops but I'm only displaying one result so I don't need a loop do I?
|
|
|