CodeIgniter Forums

Full Version: How can I load index() without memory leak?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]cleansugar[/eluser]
hello.php:

funtion Hello()
{}

function index()
{}

function submit()
{
$name = $this->input->post('formname');
$this->hello_model->insertData($name);
Hello::index();
}

I want to load index page after loading submit() page.
But Hello::index() requires memory at each time it loads recursively.
How can I load index() without memory usage?

I've used redirect(). but it returns error like "duplicated index load".

Please help me.

El Forum

[eluser]David Johansson[/eluser]
why won't $this->index(); work? also i don't understand you error with redirect...

El Forum

[eluser]cleansugar[/eluser]
$this->index() results memory consume, too.

redirect('/hello/index'); makes this error.

What can I do?

A PHP Error was encountered
Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at C:\hello\system\application\models\hello_model.php:29)

Filename: helpers/url_helper.php

Line Number: 541

El Forum

[eluser]David Johansson[/eluser]
Well redirect relies on http headers, if the headers are already set you can not use redirect. The header are automatically set when you make any kind of output (e.g by using echo)

El Forum

[eluser]David Johansson[/eluser]
why are you so afraid of consuming memory? you can't do anything without consuming memory...

El Forum

[eluser]cleansugar[/eluser]
Thank you a lot. echo was problem.