Getting menu value from MySQL

I added user register & login system into my website with PHP jQuery and MySQL. I want if the user logged in, at the main page menu change the login buttons value to the user’s name from MySQL.
I tried some sources from the internet but it didn’t work

by the way here’s the project : https://zafernci.xyz/uploadd/

1

My Menu:

    <a class="active" href="#">Home</a>
    <a href="#">Contact</a> 
    <a href="#">Products</a> 
    <a id="sign-up" href="#" onclick="SignUp()">Sign Up</a> 
       <?php if(isset($_SESSION["username"])): ?>
    <a href="logout.php">Logout  ///.$_SESSION["username"]. I tried this code but that too didn't work//// </a>
       <?php else: ?>
    <a id="log-in" href="#" onclick="LogIn()">Log In</a>
       <?php endif; ?> 
       </div>  

The Login System with MySQL:

if(isset($_POST["username"]) && isset($_POST["password"]))
{
 $username = mysqli_real_escape_string($connect, $_POST["username"]);
 $password = md5(mysqli_real_escape_string($connect, $_POST["password"]));
 $sql = "SELECT * FROM users WHERE username = '".$username."' AND Password = '".$password."'";
 $result = mysqli_query($connect, $sql);
 $num_row = mysqli_num_rows($result);
 if($num_row > 0)
 {
  $data = mysqli_fetch_array($result);
  $_SESSION["username"] = $data["username"];
  echo $data["username"];
 }
}