Error en linea 55 de mi index.php y errores en lineas de fpdf.php (biblioteca fpdf)
Publicado por Jose Francisco (29 intervenciones) el 03/10/2019 15:02:18
Buenos dias estimados, alguiene que me ayude con los siguientes errores:
[03-Oct-2019 12:53:13 UTC] PHP Fatal error: Uncaught exception 'Exception' with message 'FPDF error: Some data has already been output, can't send PDF file (output started at /home/pcc/public_html/sistema1/abmempleados/reportemple/index.php:1)' in /home/pcc/public_html/sistema1/abmempleados/reportemple/fpdf/fpdf.php:271
Stack trace:
#0 /home/pcc/public_html/sistema1/abmempleados/reportemple/fpdf/fpdf.php(1052): FPDF->Error('Some data has a...')
#1 /home/pcc/public_html/sistema1/abmempleados/reportemple/fpdf/fpdf.php(999): FPDF->_checkoutput()
#2 /home/pcc/public_html/sistema1/abmempleados/reportemple/index.php(55): FPDF->Output()
#3 {main}
thrown in /home/pcc/public_html/sistema1/abmempleados/reportemple/fpdf/fpdf.php on line 271
(CON EL EJEMPLO HOLA MUNDO (SIN BASE DE DATOS) FUNCIONA PERFECTO EL PDF, EL PROBLEMA VIENE CUANDO LO UTILIZO CON BASE DE DATOS ) AL EJECUTAR EL INDEX ME SALE PANTALLA EN BLANCO CON LOS ERRORES QUE MENCIONO EN LA PARTE SUPERIOR)
INDEX.PHP
ALQUIEN QUE ME PUEDA AYUDAR? (POR FAVOR SIEMPRE CON BIBLIOTECA FPDF, NO OTRA)
AGUARDO RESPUESTA ,GRACIAS
[03-Oct-2019 12:53:13 UTC] PHP Fatal error: Uncaught exception 'Exception' with message 'FPDF error: Some data has already been output, can't send PDF file (output started at /home/pcc/public_html/sistema1/abmempleados/reportemple/index.php:1)' in /home/pcc/public_html/sistema1/abmempleados/reportemple/fpdf/fpdf.php:271
Stack trace:
#0 /home/pcc/public_html/sistema1/abmempleados/reportemple/fpdf/fpdf.php(1052): FPDF->Error('Some data has a...')
#1 /home/pcc/public_html/sistema1/abmempleados/reportemple/fpdf/fpdf.php(999): FPDF->_checkoutput()
#2 /home/pcc/public_html/sistema1/abmempleados/reportemple/index.php(55): FPDF->Output()
#3 {main}
thrown in /home/pcc/public_html/sistema1/abmempleados/reportemple/fpdf/fpdf.php on line 271
(CON EL EJEMPLO HOLA MUNDO (SIN BASE DE DATOS) FUNCIONA PERFECTO EL PDF, EL PROBLEMA VIENE CUANDO LO UTILIZO CON BASE DE DATOS ) AL EJECUTAR EL INDEX ME SALE PANTALLA EN BLANCO CON LOS ERRORES QUE MENCIONO EN LA PARTE SUPERIOR)
INDEX.PHP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
require 'fpdf/fpdf.php';
class PDF extends FPDF
{
//cabecera de página
function Header()
{
//logo
//$this->image('logo.png',10,8,33);
//arial bold 15
$this->SetFont('Arial','B',18);
//Movernos a la derecha
$this->Cell(50);
//Título
$this->Cell(70,10,'Reporte de Empleados',0,0,'C');
//Salto de línea
$this->Ln(20);
$this->Cell(20,10,'id',1,0,'C',0);
$this->Cell(40,10,'name',1,0,'C',0);
$this->Cell(40,10,'adreess',1,0,'C',0);
$this->Cell(20,10,'salary',1,1,'C',0);
}
//Pie de Página
function Footer()
{
//Posición:a 1,5 cm del final
$this->SetY(-15);
// Arial italic 8
$this->SetFont('Arial','I',8);
//Número de página
$this->Cell(0,10,utf8_decode('Página').$this->PageNo().'/{nb}',0,0,'C');
}
}
require 'config.php';
$sql='SELECT * FROM employees';
$result = $link->query($sql);
$pdf = new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
////$pdf->SetFont("Arial","",30);
//$pdf->SetFont('Arial','',16);
// si pongo'B'es negrita
while($row=$result->fetch_assoc()){
//C centrado
$pdf->Cell(20,10,$row['id'],1,0,'C',0);
$pdf->Cell(40,10,$row['name'],1,0,'C',0);
$pdf->Cell(40,10,$row['adreess'],1,0,'C',0);
$pdf->Cell(20,10,$row['salary'],1,1,'C',0);
//1 en la última fila para salto de linea en la cuarta columna
//$pdf->SetY(10);
//$pdf->SetX(5);
//$pdf->Cell(40,10,utf8_decode ('Hola, Mundo FPDF con PHP!'));
}
$pdf->output(); ......linea 55.....
?>
ALQUIEN QUE ME PUEDA AYUDAR? (POR FAVOR SIEMPRE CON BIBLIOTECA FPDF, NO OTRA)
AGUARDO RESPUESTA ,GRACIAS
Valora esta pregunta


0