Echo only current user details

Hi, please can someone help me with this code? It shows all the users’ info but i need it to show only the info of the logged user.

<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "dbname";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
 
} 
$sql = "SELECT AEG FROM users";
$result = $conn->query($sql);
if ($result->num_rows > 3) {
  // output data of each row
  while($row = $result->fetch_assoc()) {
  echo "id: " . $row["AEG"]. "<br>";
  }
} else {
  echo "0 results";
}
 
$conn->close();
?>

Is there login or authentication code?

Sponsor our Newsletter | Privacy Policy | Terms of Service