I have read through the php manual for this problem and it seems quite a common issue but i have yet to find a solution. I am saving sessions in a database. My code is as f
You should start the session before using the session array.
PHP Code, session_start(); $_SESSION['userID'] = $user->id; header('Location: /subdirectory/index.php');