I have the following problem, the session does not keep the info.
So probably I'm making much mistakes, but I don't have a clue why,
and if you see anything else what's useless/missing, could you please say it.
This is for an login-script.

I thought it was good, till I saw in my other page (home.php), that it couldn't find the session id. 

I'm new to PHP, but it would be nice if anyone could help:)
Here is the code,

```
    <?php
    error_reporting(E_ALL ^ E_NOTICE);
    ini_set( 'display_errors', '0' );
    session_start();
    include ('db_connect.php');
    include("error.php");

    if($_SERVER['REQUEST_METHOD'] == "POST")
    {
        //formulier verstuurd
        $username = $_POST['username'];
        $password = $_POST['password'];

        //protect MySQL Injection
        $username = mysql_real_escape_string($username);
        $password = mysql_real_escape_string($password);

        $query = mysql_query("SELECT * FROM inlog WHERE username = '$username' AND password = '$password' ") or die(mysql_error());
        $rows = mysql_num_rows($query);

        if($rows == 1) {
        $_SESSION['userername'] = $username;
        header("location:home.php");
        }       
        else
        {
            $wronguser = "<div id='wronguser'>*Verkeerd gebruikersnaam of wachtwoord</div>";        
            }           
        }

        ?>

```

//dbconnect.php

```
    <?php
    $connect = mysql_connect( 'localhost', 'root', 'root' );
    mysql_select_db('applicatie', $connect);
    ?>

```

//error.php

```
    <?php
    ini_set('display_errors',1); 
     error_reporting(E_ALL);
    ?>

```

---

Update.
I can't login anymore because the session is not true anymore:/