I've been working on a website that has a membership system, users can buy plans and then it is added to their account. I'm having a problem with the de-activation of the members once it has expired.
$time_current = time();
$db_mem_check = mysqli_query($con, "SELECT * FROM members");
while ($row = mysqli_fetch_array($db_mem_check, MYSQLI_ASSOC)) {
$id = $row['id'];
$time_exp = (int)$row['mem_expiration_time'];
if ($time_exp = 0) {
} else {
$db_update = mysqli_query($con, "UPDATE members SET title='No Membership',mem_rank='none',mem_expiration='unknown',mem_expiration_time='0' WHERE mem_expiration_time < '$time_current' and id = '$id'");
if(!$db_update) {
$danger[] = "MySqli Error: ".mysqli_error($con);
}
}
}
So the problem is that whenever a user refreshed the page, it changes everyone's title and mem_rank to No Membership and none, but i want it to ignore changing the database if it is 0.
Sorry if I worded this awkwardly, it is kinda hard to explain. Thanks in advance everyone!