doubts report with library fpdf

0

Hello friends from the best forum in the world! I try to make a report in pdf of a tutorial of my CRUD USING FPDF, but with negative results, when calling report.php it gives me error 500 and it does not show anything. I HOPE THE HELP OF THE OLIMPO OF THE KNOW .... MY FILES

reporte.php

    <?php
// ver errores
 error_reporting(E_ALL);
ini_set('display_errors', '1');
 ?>
<?php

include 'plantilla.php'
require 'conexion.php';


 $sql ="SELECT id_tecnico, nombre, telefono, direccion, email from tecnicos";
    $resultado = $mysqli->query($query);

$pdf = new PDF();
$pdf->AliasNbPages();

$pdf->AddPage();
$pdf->SetFillColor(232,232,232);

$pdf->SetFont('Arial', 'B', 12);

$pdf->Cell(40, 6, 'nombre',1,0,'C',1);

$pdf->Cell(40, 6, 'telefono',1,0,'C',1);

$pdf->Cell(40, 6, 'direccion',1,0,'C',1);

$pdf->Cell(50, 6, 'email',1,1,'C',1);


$pdf->SetFont('Arial','',10);

    while($row = $resultado->fetch_assoc())
    {
        $pdf->Cell(40,6,utf8_decode($row['nombre']),1,0,'C');
        $pdf->Cell(40,6,utf8_decode($row['telefono']),1,0,'C');
        $pdf->Cell(40,6,utf8_decode($row['direccion']),1,0,'C');
        $pdf->Cell(50,6,utf8_decode($row['email']),1,1,'C')

    }
$pdf->Autput();
?>

template.php

  <?php

error_reporting(E_ALL);
ini_set('display_errors', '1');

?>

<?php
// require 'conexion.php';
require 'fpdf/fpdf.php';


class PDF extends FPDF
{


    function Header()
    {

$this->image('img/tec.png', 5, 5, 30);
$this->SetFont('Arial', 'B', 15);
$this->Cell(30);
$this->Cell(120, 10, 'Reporte de Service Robert',0,0,'C');
$this->Ln(20);


    }


function Footer()
{

$this->SetY(-15);
$this->SetFont('Arial', 'I', 8);

$this->Cell(0,10,'Página  '.$this->PageNo().'/{nb}',0,0,'C');

}




}

?>
    
asked by kuky 02.10.2018 в 08:44
source

1 answer

0

THIS WAY I WORK PERFECT

reporte.php

<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
?>
<?php
include 'plantilla.php';
require 'conexion.php';


 $sql ="SELECT  nombre, telefono, direccion, email from tecnicos";
    $resultado = $mysqli->query($sql);

$pdf = new PDF();
$pdf->AliasNbPages();

$pdf->AddPage();
$pdf->SetFillColor(232,232,232);

$pdf->SetFont('Arial', 'B', 12);

$pdf->Cell(40, 6, 'nombre',1,0,'C',1);

$pdf->Cell(40, 6, 'telefono',1,0,'C',1);

$pdf->Cell(40, 6, 'direccion',1,0,'C',1);

$pdf->Cell(50, 6, 'email',1,1,'C',1);


$pdf->SetFont('Arial','',10);

    while($row = $resultado->fetch_assoc())
    {
        $pdf->Cell(40,6,utf8_decode($row['nombre']),1,0,'C');
        $pdf->Cell(40,6,utf8_decode($row['telefono']),1,0,'C');
        $pdf->Cell(40,6,utf8_decode($row['direccion']),1,0,'C');
        $pdf->Cell(50,6,utf8_decode($row['email']),1,1,'C');

    }
$pdf->Output();
?>

template.php

<?php

error_reporting(E_ALL);
ini_set('display_errors', '1');

?>

<?php
// require 'conexion.php';
require 'fpdf/fpdf.php';


class PDF extends FPDF
{


    function Header()
    {

$this->image('img/tec.png', 5, 5, 30);
$this->SetFont('Arial', 'B', 15);
$this->Cell(30);
$this->Cell(120, 10, 'Reporte de Service Robert',0,0,'C');
$this->Ln(20);


    }


function Footer()
{

$this->SetY(-15);
$this->SetFont('Arial', 'I', 8);

$this->Cell(0,10,'Página  '.$this->PageNo().'/{nb}',0,0,'C');

}

I put these lines to see the errors

<?php

    error_reporting(E_ALL);
    ini_set('display_errors', '1');

    ?>

if it serves as a contribution, it will be a grain of sand ....

    
answered by 02.10.2018 в 11:40