It will not reach my head how to implement the correct code.
<?php
$conn = mysqli_connect("local host", "root", "root", "penguin_rus");
$_SESSION["id"] = 1;
$sessionId = $_SESSION["id"];
$user = mysqli_fetch_assoc(mysqli_query($conn, "SELECT * FROM tb_user WHERE id = $sessionId"));
?>
(script used to load/update avatar)
where: $_SESSION["id"] = 1;
A user on the network, and specifically, instead of assigning the number 1, there should be an assignment of an online user id on the network, which should be taken from the database during authorization.
I can’t figure out what to assign $_SESSION["id"] = !
If a user enters the site with id 222, he will still be assigned id 1 from the table.