title: session_start(); doesn't work?
body: <p>I've solved my last problem, but I have another now.
  I have searched on google and stackoverflow for hours now, I think. But i can't get it to work.</p>
  
  <p>When I login, using this:</p>
  
  <pre><code>&lt;?php
              if(isset($_POST['submit'])) {
                  $username = $mysqli-&gt;real_escape_string($_POST['username']);
                  $password = $mysqli-&gt;real_escape_string(md5($_POST['password']));
  
                  $checkUser = "SELECT * FROM users WHERE username='".$username."' AND password='".$password."'";
                  $checkUserResult = $mysqli-&gt;query($checkUser);
  
                  if($checkUserResult-&gt;num_rows &gt; 0) {
                      $userRow = $checkUserResult-&gt;fetch_assoc($checkUserResult);
  
                      $dbid = $userRow['id'];
                      $dbuser = $userRow['username'];
  
                      $_SESSION['id'] = $dbid;
                      $_SESSION['username'] = $dbuser;
  
                      header("location: me.php");
                  } else {
                      echo "&lt;div class='errorField'&gt;Anv&amp;auml;ndarnamnet och/eller l&amp;ouml;senordet &amp;auml;r fel!&lt;/div&gt;";
                  }
              }
          ?&gt;
  </code></pre>
  
  <p>It's redirects me to the me.php, wich is this codes:</p>
  
  <pre><code>&lt;?php
  include "core/global.php";
  echo (headers_sent())?'sent':'not sent';
  session_start();
  $id = $_SESSION['id'];
  $username = $_SESSION['username'];
  
  if(!isset($_SESSION['id'])) { header("location: index.php"); } ?&gt;
  </code></pre>
  
  <p>But then it redirects me back to the Index.php (cause of the session) and if i try to use </p>
  
  <pre><code>echo (headers_sent())?'sent':'not sent';
  </code></pre>
  
  <p>It says 'not sent'</p>
  
  <p>The session doesn't work... for some reason I dont know.
  My friend, who Is a OOP "pro" can't even solve this... so please, help me!</p>
  
  <p>Thanks.</p>
  
  <p>PS. The session_start() on the login page, is on THE TOP OF THE PAGE:
  <strong><a href="http://prntscr.com/1g7ohh" rel="nofollow">http://prntscr.com/1g7ohh</a></strong></p>