Trying to run a loop based on a session variable.
On the first page load no session.
when it sets the session i sets a session variable and alerts.
Problem being, it alerts every page load 🙁
`
<!-- language: lang-php -->
$check = $_SESSION['cache'];
if ($check == "xYx") {
echo $word;
} else {
session_start();
?><script>alert ("Im reading it again !")</script><?
echo $word;
$_SESSION['cache'] = "xYx";
}
`
Just do this:
Which is just simply moving
session_start()to the beginning as the comments said.