It worked in a localhost XAMMP, I put it in a free hosting 000webhost to try it
Warning: A non-numeric value encountered in /storage/ssd2/023/3036023/public_html/pdf/fpdf/fpdf.php on line 580
Warning: A non-numeric value encountered in /storage/ssd2/023/3036023/public_html/pdf/fpdf/fpdf.php on line 580
Warning: A non-numeric value encountered in /storage/ssd2/023/3036023/public_html/pdf/fpdf/fpdf.php on line 580
Warning: A non-numeric value encountered in /storage/ssd2/023/3036023/public_html/pdf/fpdf/fpdf.php on line 580
Fatal error: Uncaught Exception: FPDF error: Some data has already been output, can't send PDF file (output started at /storage/ssd2/023/3036023/public_html/pdf/fpdf/fpdf.php:580) in /storage/ssd2/023/3036023/public_html/pdf/fpdf/fpdf.php:271 Stack trace: #0 /storage/ssd2/023/3036023/public_html/pdf/fpdf/fpdf.php(1053): FPDF->Error('Some data has a...') #1 /storage/ssd2/023/3036023/public_html/pdf/fpdf/fpdf.php(1000): FPDF->_checkoutput() #2 /storage/ssd2/023/3036023/public_html/pdf/reporteproductos.php(32): FPDF->Output() #3 {main} thrown in /storage/ssd2/023/3036023/public_html/pdf/fpdf/fpdf.php on line 271
this is template.php
session_start();
require 'fpdf/fpdf.php';
class PDF extends FPDF
{
function Header()
{
//$this->image('images/sen2.png', 10, 10,50);
$this->Image('images/sen2.png' , 10, 10,50);
$this->SetFont('Arial','B',15);
$this->Cell(50,'','',0);
$this->Cell(140,5,'BOUTIQUE MARIA FERNANDA',0,1,'R');
$this->SetFont('Arial', 'B', 11);
$this->Cell(50,'','',0);
$this->Cell(140,5,'NIT 900354851-5',0,1,'R');
$this->Cell(50,'','',0);
$this->Cell(140,5,'Hoy: '.date('d-m-Y').'',0,1,'R');
$this->Cell(50,'','',0);
$this->Cell(140,5,'Usuario|'.$_SESSION['usuario'].'',0,1,'R');
$this->Ln(5);
}
// function Footer()
// {
// $this->SetY(-15);
// $this->SetFont('Arial','I',8);
// $this->Cell(0,10,'Pagina '$this->PageNo().'/{nb}',0,0,'C');
// }
function Footer()
{
//Footer de la pagina
$this->SetY(-15);
$this->SetFont('Arial','I',8);
$this->SetTextColor(128);
$this->Cell(0,10,'Pagina '.$this->PageNo(),0,0,'C');
}
}?>
here called template, it was working in a localhost; until I put it in 000webhost.
include 'plantilla.php';
require 'config.php';
$sql="SELECT * FROM tb_productos ORDER BY cod_producto ASC ";
$resultado = $conexion->query( $sql );
$pdf= new PDF();
// $pdf->AliasNbPage();
$pdf->AddPage();
$pdf->Cell(120,10,'Reporte de Productos ',0,1,'L');
$pdf->SetFillColor(232,232,232);
$pdf->SetFont('Arial','B',12);
$pdf->Cell(25,6,'CODIGO',1,0,'C',1);
$pdf->Cell(65,6,'NOMBRE',1,0,'C',1);
$pdf->Cell(50,6,'PRECIO DE COMPRA',1,0,'C',1);
$pdf->Cell(50,6,'FECHA DE REGISTRO',1,1,'C',1);
$pdf->SetFont('Arial','',10);
while ($row = $resultado->fetch_assoc())
{
$pdf->Cell(25,6,$row['cod_producto'],1,0,'C');
$pdf->Cell(65,6,utf8_decode($row['descripcion']) ,1,0,'C');
$pdf->Cell(50,6,$row['precio_compra'],1,0,'C');
$pdf->Cell(50,6,$row['fecha_registro'],1,1,'C');
}
$pdf->Output();?>