I am trying to setup $_SESSION data and echo it out onto the page. I am defining the sessions in the header
<?php
$users = $mysqli->query('SELECT * FROM fn WHERE username = '.$_SESSION['username']);
if (is_object($users)) {
if ($users->num_rows) {
while ($row = $users->fetch_assoc()) {
$first_name = $row['first_name'];
$last_name = $row['last_name'];
$email = $row['email'];
$number = $row['number'];
$region = $row['region'];
$company = $row['company'];
$level = $row['level'];
}
}
}
$_SESSION['first_name'] = $first_name;
?>
I am then including the header.php file on my page and also using session_start();
I have no idea what im doing wrong.
I am managing to get the username and password to echo out... I assume its because it was added to the session upon login.
$mysqli->query("SELECT * FROM fn WHERE username = '".$_SESSION['username']."'");
– Qirel