This is my page:
<?php
require_once '\..\core\init.php';
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
session_start();
$data = array();
$mes_formulario = $_GET['mes'] ?? date('m-Y');
$dia = date_create_from_format('m-Y', $mes_formulario);
$mes = $dia->format('n');
$inicio = date_create_from_format('j-n', '15-'.$mes);
$fin = date_create_from_format('j-n', '15-'.$mes+1);
$aprobado = $consulta->consultauni("SELECT COUNT(*) as Q from base WHERE CERTI = 'SI' AND EMPRESA = 'SOMETHING' AND FECHA_ENVIO >= ". $inicio . "AND FECHA_ENVIO < " . $fin);
$data['aprobado'] = $aprobado;
$data['mes'] = date_create_from_format('j-n', '1-'.$mes);
$_SESSION['datos_cuadro'] = $data;
if(!headers_sent()) {
header("Location: vista_bec.php");
}
I usually work with framework PHP so plain old PHP is new to me. I've read a few solutions to this but none of them applied to my case. PHP file for the redirection is within the same folder as this file. No errors get displayed.
EDIT:
Changed the code to this quickly but still get a blank page:
$data = array();
$mes_formulario = $_GET['mes'] ?? date('m-Y');
$dia = date_create_from_format('m-Y', $mes_formulario);
$mes = $dia->format('n');
$inicio = date_create_from_format('j-n', '15-'.($mes));
$inicio = $inicio->format('Y-m-d');
$fin = date_create_from_format('j-n', '15-'.($mes+1));
$fin = $fin->format('Y-m-d');