I'm attempting to make a login system, which then redirects to the appropriate pages if the right details were entered or not.
session_start();
$result = mysqli_query($con, "my query");
if(mysqli_num_rows($result) == 1)
{
$_SESSION['username'] = $username;
header("Location: home.php");
}
else
{
header("Location: login.php");
}
However, if I enter the right details I get: "Undefined variable: _SESSION
".
I don't really know what's going wrong here.