I want to keep one content of the variable when I refresh because it is kind of like a counter and this is the code that I have got using session, but it does not seem to want to work.
And yes, I have looked at other websites for the error, and I have removed all unneccesary white spaces etc.
session_start();
$result = mysql_query('SELECT MIN(ID) AS min, MAX(ID) AS max FROM ytable') or exit(mysql_error());
$row = mysql_fetch_assoc($result);
if($_SESSION['counter'] < $row['max']){
if (isset($_SESSION['counter'])){
$counter = $_SESSION['counter']++;
}else{
$counter = $_SESSION['counter'] = 0;
}
}
Is there something wrong with my code? If not, is there any other way to do the same thing?