Welcome Guest, Not a member yet? Register   Sign In
[URI HELPER ERROR]Message: Cannot modify header information - headers already sent by (output started at C:\.......)
#1

[eluser]Ngulo[/eluser]
Hi all guys... i'm in trouble with redirect() in CI

i receive always this message:

Code:
Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at C:....\site\application\models\download.php:2)

Filename: helpers/url_helper.php

Line Number: 541

i really can solve this problem , i don't know why it doesn't works :/

my code is so simple ,but seems that using $this->uri->segment() before a redirect() ,creates me this problem :/

this is my code:
Code:
function cd()
        {
            $id =  $this->uri->segment(3);
            if(is_numeric($id) and $id > 0 and $id < 6)
            {
            $date = date('d-m-o');
            $datetime = date('H:i:s');
            $ip = htmlentities($_SERVER['REMOTE_ADDR']);
            $this->load->model('download');
            $cd = $this->download->populateById($id);
            $disco_name = $cd->downloads_disco;
            $new_downloads_number = $cd->downloads_number + 1;
            //dat for update
            $data = array(
                'downloads_number'=>$new_downloads_number,
                    );
            $updateDownloadsNumber = $this->download->update($id,$data);
            unset($data);
            $this->load->model('downloaddetails');
            $data = array(
                'id_downloads_details'=>$id,
                'ip_downloads_details'=>$ip,
                'date'=>$date,
                'datetime'=>$datetime
            );
            $this->downloaddetails->insert($data);
            
             redirect(base_url().'/downloads/cd/'.$disco_name.'.rar');
            }
            else{ exit;}
        }

it's so simple my function ,that i really can't understand the reason why it doesn't works

any suggestions ? Tongue

really thanks guys Wink


Messages In This Thread
[URI HELPER ERROR]Message: Cannot modify header information - headers already sent by (output started at C:\.......) - by El Forum - 08-13-2010, 10:22 AM



Theme © iAndrew 2016 - Forum software by © MyBB