I'm having an error in my code
<?php
require_once "../../controllers/gestorsuscriptores.php";
require_once "../../models/gestorsuscriptores.php";
require_once('tcpdf_include.php');
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->AddPage();
$html = <<<EOF
<img src="images/logo_example.jpg" style="width:300px">
EOF;
$pdf->writeHTML($html, false, false, false, false, '');
$pdf->Output('pdf.pdf', 'I');
?>
The problem that I find is that when I write the code
require_once "../../controllers/gestorsuscriptores.php";
require_once "../../models/gestorsuscriptores.php";
I get the error of: TCPDF ERROR: Some data has already been output, can not send PDF file
THE ARCHIVES I HAVE IN THE FOLDERS, THIS WAY
WHEN I WRITE THE FIRST CODE LINE, IT DOES NOT GIVE ME ANY ERROR
require_once "../../controllers/gestorsuscriptores.php";
BUT WHEN WRITING THE SECOND, IT IS WHERE THE ERROR JUMPS
require_once "../../models/gestorsuscriptores.php";
TCPDF ERROR: Some data has already been output, can not send PDF file
AND IF I JUST WRITE THE SECOND CODE WITHOUT THE FIRST, IT WILL ALSO GIVE ERROR
THE FILE CODE gestorsuscriptores.php IS THIS:
<?php
require_once 'conexion.php';
class SuscriptoresModel
{
#MOSTRAR SUSCRIPTORES EN LA VISTA
#------------------------------------------------------------------------------
public function mostrarSuscriptoresModel($tabla)
{
$stmt = Conexion::conectar()->prepare("SELECT id, nombre, email FROM $tabla");
$stmt -> execute();
return $stmt -> fetchAll();
$stmt -> close();
}
#BORRAR SUSCRIPTORES
#------------------------------------------------------------------------------
public function borrarSuscriptoresModel($datosModel,$tabla)
{
$stmt = Conexion::conectar()->prepare("DELETE FROM $tabla WHERE id = :id");
$stmt->bindParam(":id", $datosModel, PDO::PARAM_INT);
if ($stmt->execute())
{
return "ok";
}
else
{
return "error";
}
$stmt->close();
}
}
I REALLY DO NOT KNOW WHAT'S HAPPENING I HOPE AND CAN ANSWER AND IN ADVANCE MANY THANKS