Welcome Guest, Not a member yet? Register   Sign In
Erg, header errors irritating me
#1

[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?
#2

[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?
#3

[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);
                        
      }
      

      
              
      
}

?>
#4

[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.
#5

[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.




Theme © iAndrew 2016 - Forum software by © MyBB