Greetings. What I'm trying to do is the following. I need to count and show how many students have the payment date on the current day, to show it on an alert that says There are 4 students who must pay today. And I also want to list the names of students with today's payment date. I've done the query but apparently he's not telling me the records. The tables I have related as follows:
The tables are related as can be seen. The query that I have made is the following:
<?php
include '../lib/conexion.php';
date_default_timezone_set('America/Caracas');
setlocale(LC_ALL, "es_ES");
$hoy = date('d-m-Y');
$query = current($mysqli->query("SELECT COUNT(pagos_estudiantes.id),
students.names FROM students INNER JOIN inscritos ON
inscritos.id_student = students.id_students INNER JOIN pagos_estudiantes
ON pagos_estudiantes.id_inscripcion = inscritos.id WHERE
pagos_estudiantes.fecha_a_pagar = $hoy")->fetch_assoc());
if($query){
$alert = $query;
$result = "Hay " . $query . "que deben cancelar hoy";
}
echo $alert;
echo $result;
?>
That's my query but as I said what it shows is a 0 in the alert, I mean it's not counting the records. What I need is to show the number of registrations with date_to_pay = today and the names of those students