Welcome Guest, Not a member yet? Register   Sign In
First Question from a new CI user
#1

[eluser]trope[/eluser]
I am expanding a bit on the blog tutorial.

I am passing a "success" message to my view, which tells the user the record was created successfully.

The problem is, when I insert the records and return to the "admin_view" view, no records are shown (even though they are there).

It appears the URL is wrong when it loads the view.

Here is my newbie code:

Code:
function index()
    {
        
        $data = array();

        /* Check to see if we have records available */
        if($query = $this->admin_model->get_records() )
        {
            
                $data['records'] = $this->admin_model->get_records();
              
    
        }
        
        $this->load->view('admin_view', $data);
        
    }
    
    
    function add_post(){

        $this->load->view('admin_create_view');
        
    }
    
    
    function create_new_post(){
        
        $data = array(
            'title' => $this->input->post('title'),
            'body' => $this->input->post('body'),
            'date_posted' => date("Y-m-d")
        );
        
        $this->admin_model->add_record($data);

        $data['notification_message'] = "You have successfully created a new blog post";
        
        $this->load->view("admin_view",$data);
        
    }

So when I insert a record, it DOES display the success message, but no records are displayed. And the URL after the insert appears not to have changed.

I have attached screenshots of the error.

Thanks, and glad to be here!

John


Messages In This Thread
First Question from a new CI user - by El Forum - 07-10-2010, 11:42 AM
First Question from a new CI user - by El Forum - 07-10-2010, 12:09 PM
First Question from a new CI user - by El Forum - 07-11-2010, 04:38 PM
First Question from a new CI user - by El Forum - 07-11-2010, 05:29 PM
First Question from a new CI user - by El Forum - 07-12-2010, 12:00 AM
First Question from a new CI user - by El Forum - 07-12-2010, 05:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB