My problem is this, I am trying to show a table with the people who must cancel in the month of January or any month, I do it in the following way:
First step in a link the initial data via GET
<a href="calendario.php?dato=<?php echo date('01-m-Y');; ?>">
That information I receive here and execute my query:
<?php
if(isset($_GET['dato'])){
$dato2 = date('t-m-Y');
$fecha = $_GET['dato'];
$query = "SELECT * 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 BETWEEN '$fecha' AND
'$dato2'";
$sql = $mysqli->query($query);
while($row = $sql->fetch_assoc()){ ?>
<tbody>
<tr>
<td><?php echo $row['names'] ?></td>
<td><b><?php echo $row['monto'] ?></td>
<td><?php echo $row['fecha_a_pagar'] ?></td>
</tr>
</tbody>
<?php } ?>
<?php } ?>
The result I get from that is not the desired one, it shows me all the records that I have, that is, all the people that are registered in the system. And I just want to show what the date to pay this for example between 01-01-2018 and 01-01-2018. Thanks in advance for your help.