0
I’m having problems with a code, as I’m new in the area I’m developing just to learn. What I want to do: Perform a monthly access control of the user, that is, if it is not paid the monthly fee it does not access. My problem is to check if the user’s expiration date is less than or equal to CURRENT DATE. If the expiration date is equal to the current date, the value of the "paid" column will be "0", i.e., it did not pay. Otherwise, "1". I’m doing it this way:
function isExpired()
{
global $conn;
global $empresa;
$sql2 = mysqli_query($conn, "SELECT * FROM clientes WHERE nome_fantasia = '$empresa' AND DATE(expire_date) = DATE(NOW())");
if (mysqli_fetch_row($sql2)==1) {
//expirou
$confere = "UPDATE FROM clientes SET `pago` = 0 WHERE nome_fantasia = '$empresa'";
$editar = mysqli_query($conn, $confere); //Realiza a consulta
if ($editar == '') {
echo 'nao deu';
} else {
echo 'alterou';
}
}
}
isExpired();
I do not know if it was clear what I want, I apologize. Anything I try to explain more. PS: to learn how to play with functions, ANY HINT or CRITICISM is SUPER WELCOME. The code does not return me nor the
if ($editar == '') {
echo 'nao deu';
} else {
echo 'alterou';
}
obg.