This is part of my login page, everything used to work I'm not sure if i changed something that caused an error. When printing the $_SESSION it says array but when i try to print $_SESSION['user'] like i saved the data in the code below it will not work???
require("includes/connection.php");
echo $_SESSION;
echo $_SESSION['user'];
echo ' ';
if(empty($_SESSION['user']))
{}
login page info, when i print the row is shows the array but when i change the page destination and try to print above the session is not printing anything.
unset($row['salt']);
unset($row['password']);
echo $row['username'];
$_SESSION['user'] = $row;
add this in first line;
ob_start();
session_start();
You need to use session_start();
at the top and $_SESSION
is an array, you cant use echo
, so you need to use print_r($_SESSION);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.