You have to be very meticulous about the pairing of opening and closing tags, brackets, and so on, for example, this block of code should be:
<?php
session_start();
require "conn.php";
if(!isset($_SESSION["user"]))
{
header("location:login.php");
}
else
{
$user = $_SESSION["user"];
$sql = "SELECT * FROM users WHERE Username = '".$user."'";
$result = $conn->query($sql);
while($row = mysqli_fetch_assoc($result))
{
$db_id = $row["Id"];
$db_username = $row["Username"];
$db_forename = $row["Forename"];
$db_surname = $row["Surname"];
$db_email = $row["Email"];
$db_bio = $row["Bio"];
$db_status = $row["Status"];
echo "<center>Welcome <h2>$db_forename $db_surname!</center></h2>";
echo "<p align='right'><a href='logout.php'>$user Log Out</a></p><br>";
}
}
?>
You have to figure out the rest if any. Last but not least, you should be using
PHP Prepared Statements[
^] to prevent the risk of
SQL injection[
^]