Welcome Guest, Not a member yet? Register   Sign In
Headers already sent? But how?
#1

[eluser]parham90[/eluser]
Hi,

Here I am again, with another mystery!

First of all, I am not setting any headers at all. I am just adding a value to the database. However, this is the error I get:

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\system\application\controllers\welcome.php:1)

Filename: codeigniter/Common.php

Line Number: 360

Here is the welcome.php:

Code:
<?php

class Welcome extends Controller {

    function Welcome()
    {
        parent::Controller();    
    }
    
    function index()
    {
        $this->load->view('welcome_message');
    }

function test()
{
$this->load->database();
$test = array(
'testcolumn' => 'صفحه اصلی'
);
if ($this->db->insert('testtable', $test))
$data['result'] = "worked!";
else
$data['result'] = "Didn't work!";
$this->load->view('welcome/test', $data);
}

}

/* End of file welcome.php */
/* Location: ./system/application/controllers/welcome.php */

And here is views/index/test.php:

Code:
<html>
<head>
<title>Hihi!</title>
</head>
<body>
OK. You know, the script actually...
<br/>
&lt;?if ($result == "worked!"):?&gt;
Whoo hoo! Worked!
&lt;?else:?&gt;
well, didn't work. Damn!
&lt;?endif;?&gt;
<br/>
Anyway, bye!
&lt;/body&gt;
&lt;/html&gt;

This code was primarily to test adding of unicode values (Farsi in this instance) to Postgre.

Any ideas?

Thanks a bunch!


Messages In This Thread
Headers already sent? But how? - by El Forum - 07-22-2010, 09:01 AM
Headers already sent? But how? - by El Forum - 07-22-2010, 09:07 AM
Headers already sent? But how? - by El Forum - 07-22-2010, 09:33 AM
Headers already sent? But how? - by El Forum - 07-22-2010, 09:45 AM
Headers already sent? But how? - by El Forum - 07-22-2010, 09:51 AM
Headers already sent? But how? - by El Forum - 07-22-2010, 10:16 AM



Theme © iAndrew 2016 - Forum software by © MyBB