CodeIgniter Forums
Erg, header errors irritating me - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Erg, header errors irritating me (/showthread.php?tid=10078)



Erg, header errors irritating me - El Forum - 07-17-2008

[eluser]Bl4cKWid0w[/eluser]
Whenever I try to redirect, I get header errors that say the headers were already sent out by a line that doesn't contain anything. I loaded the url helper at the top of my page but it still won't work... can someone please help me?


Erg, header errors irritating me - El Forum - 07-17-2008

[eluser]Aea[/eluser]
As soon as I gain the ability to read minds sure, can we get all the relevant code posted here? Can you also make sure you're not loading any libraries or helpers, etc that have debug output?


Erg, header errors irritating me - El Forum - 07-17-2008

[eluser]Bl4cKWid0w[/eluser]
The errors occur when pollVote is executed. This is the page that pollVote is located:
Code:
<?php

class Main extends Controller {

      function pollVote()
      {
      $this->load->helper('url');
      redirect('index.php');
      
      //Client's IP Address
      
      
      //Has the voter already participated in this poll?
    
           $this->db->query("UPDATE pollOptions SET votesFor = votesFor+1");
        $choice = $_POST['choice'];
        $this->db->query("INSERT INTO pollVotes (voterID,optionID,voterIP) values(0, $choice, 0)");
        
        
      }

      function main()
      {
      
      parent::Controller();
      $this->load->scaffolding('navlinks');
      
      }

      function index()
      {

           $this->load->helper('url');
        $this->load->helper('form');
        
                $data['catquery'] = $this->db->query("SELECT * FROM navlink_cats ORDER BY categoryID");
             $data['newsquery'] = $this->db->query("SELECT * FROM news ORDER BY newsID DESC LIMIT 3");
             $data['tutorialsquery'] = $this->db->query("SELECT * FROM tutorials ORDER BY tutorialID DESC LIMIT 5");
             $data['pollquery'] = $this->db->query("SELECT * FROM polls ORDER BY pollID DESC LIMIT 1");
             $query1 = $this->db->query("SELECT * FROM members");
             $query2 = $this->db->get('tutorials');
             $query3 = $this->db->get('smf_topics');
             $query4 = $this->db->get('smf_replies');
             $data['statsmems'] = $query1->num_rows();
             $data['statstuts'] = $query2->num_rows();
             $data['statstopics'] = $query3->num_rows();
             $data['statsreplies'] = $query4->num_rows();
             $this->load->view('main_view', $data);
                        
      }
      

      
              
      
}

?>



Erg, header errors irritating me - El Forum - 07-18-2008

[eluser]Grahack[/eluser]
Check if you have no whitespace before the <?php tag. Sometimes the encoding is involved, adding some mysterious invisible chars at the begining of the file.


Erg, header errors irritating me - El Forum - 07-18-2008

[eluser]Derek Jones[/eluser]
Or afterward. You'll notice that starting with the previous release of CI, none of the framework's files even have a closing PHP tag. It's not required, and eliminates the possibility of premature output from whitespace at the end of files, which some FTP applications have even been known to cause on occasion.