I have a table which shows a monthly condominium invoice, but I need to show the expenses that were recorded in the last month only in the database and not all the expenses that are, here is how the table is formed of the database
Here is the code I'm using to make the query but it shows me as an error Warning: mysqli_fetch_array () expects parameter 1 to be mysqli_result, boolean given
require_once('./conexion.php');
$sql = "SELECT * FROM gasto_g WHERE created_at BETWEEN DATE_SUB(NOW(), INTERVAL 2 MONTH) AND NOW() ORDER BY id_gasto_g DESC;" ;
$res = mysqli_query($conexion,$sql);
while($resultado = mysqli_fetch_array($res)){
?>
<tr>
<td><?php echo $resultado['id_gasto_g']; ?></td>
<td><?php echo $resultado['descripcion']; ?></td>
<td><?php echo $resultado['monto']; ?></td>
<td>