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

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?

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?

The errors occur when pollVote is executed. This is the page that pollVote is located:

class Main extends Controller {

      function pollVote()
      //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()

      function index()

                $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);



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.

[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