title: Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent
body: <p>I received an error on my php code something like this:</p>
  
  <pre><code>Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home4/iamden83/public_html/loop/signup.php:1) in /home4/iamden83/public_html/loop/signup.php on line 2
  </code></pre>
  
  <p>And the code is this</p>
  
  <pre><code>&lt;?php
  session_start();
  // If user is logged in, header them away
  if( isset( $_SESSION["username"] ) ){
      header( "location: message.php?msg=NO to that weenis" );
      exit();
  }
  ?&gt;&lt;?php
  // Ajax calls this NAME CHECK code to execute
  if(isset($_POST["usernamecheck"])){
      include_once("php_includes/db_conx.php");
      $username = preg_replace('#[^a-z0-9]#i', '', $_POST['usernamecheck']);
      $sql = "SELECT id FROM users WHERE username='$username' LIMIT 1";
      $query = mysqli_query($db_conx, $sql); 
      $uname_check = mysqli_num_rows($query);
      if (strlen($username) &lt; 3 || strlen($username) &gt; 16) {
          echo '&lt;strong style="color:#F00;"&gt;3 - 16 characters please&lt;/strong&gt;';
          exit();
      }
      if (is_numeric($username[0])) {
          echo '&lt;strong style="color:#F00;"&gt;Usernames must begin with a letter&lt;/strong&gt;';
          exit();
      }
      if ($uname_check &lt; 1) {
          echo '&lt;strong style="color:#009900;"&gt;' . $username . ' is OK&lt;/strong&gt;';
          exit();
      } else {
          echo '&lt;strong style="color:#F00;"&gt;' . $username . ' is taken&lt;/strong&gt;';
          exit();
      }
  }
  </code></pre>