query("SELECT a.*, r.nombre as responsable_nombre FROM actividades a LEFT JOIN responsables r ON a.responsable_id = r.id ORDER BY a.fecha_inicio, a.hora_inicio"); $actividades = $stmt->fetchAll(PDO::FETCH_ASSOC); // This is just a placeholder, we will calculate this properly in a future step. $total_actividades = count($actividades); ?>