Welcome Guest, Not a member yet? Register   Sign In
send to page!
#1

[eluser]WebbHelp[/eluser]
Hi!

I am creating a blog, and I point out that I am a beginner with CodeIgniter Smile

When you in the blog, have post a new blogpost, a function add is running, and the post are being add in the database:


Code:
$this->db->insert("posts", array('subject' => $subject , 'message' => $message));
            $this->load->view('blog_view',$this->data);

You see, when I post in the database, the page that shows all blogposts is loaded.
The problem is how can I make the page blog_view to reload or something like that.
Because when I add a post in the database and then load the blog_view, I don't see the new post I just added, because I need to reload the page before.

Thanks //WebbHelp
#2

[eluser]Damien K.[/eluser]
Code:
$this->load->view('blog_view',$this->data);

This response is based on certain assumptions.

Your code above pass the data to your blog_view page. However, $this->data was populated with all the blog posts before the newly inserted post, so you don't see the new blog post. Insert your post first then populate $this->data.
#3

[eluser]InsiteFX[/eluser]
redirect('blog_view', 'refresh');

Enjoy
InsiteFX
#4

[eluser]WebbHelp[/eluser]
Yes. you both right, why didn't I think about that Damien . K.
You right, I put the posts in $data before I insert.

Thanks for helping Smile




Theme © iAndrew 2016 - Forum software by © MyBB