View Single Post
Old 11-11-2009, 09:25 PM   #1 (permalink)
Jmz
The Acquainted
 
Join Date: Oct 2007
Location: Newcastle, UK
Posts: 113
Thanks: 3
Jmz is on a distinguished road
Default 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?
__________________
Free CSS Tutorials
Send a message via MSN to Jmz
Jmz is offline  
Reply With Quote