I have a div where I search only logged in users, in it I'm displaying the users but every update is inserted new records, gave me the hint of using cookise more never worked with it. the following code is giving the error Warning: Can not modify header information already -
<?php
$id_usuario = $_SESSION['user_id'];
$usuario = $_SESSION['user_name'];
setcookie($usuario, $id_usuario, time() + (86400 * 30), "/");
if(!isset($_COOKIE[$usuario])) {
echo "Cookie named '" . $usuario . "' is not set!";
} else {
echo "Cookie '" . $usuario . "' is set!<br>";
echo "Value is: " . $_COOKIE[$usuario];
}
?>
Following this tutorial link