Problem with FPDF

0

What about Friends very good night, I have a small problem with the FPDF tool on my website, the thing is that in localhost everything works perfectly, but by taking my php to the online hosting and request the pdf the page stays in White completely without printing any results or errors.

my php code is as follows:

<? @$id = @$_GET['id']; ?>
 <?

include('config.php');

@$userid = $_SESSION["id_usuario"];

$link=Conectarse();

 $query = "SELECT * from orders WHERE 'id' = '$id' ORDER BY 'orders'.'id' DESC";     // Esta linea hace la consulta 
    $result = mysql_query($query);
   $registro = mysql_fetch_array($result);
   $factura = $registro['id']; 
   $cantidad = $registro['cantidad']; 
   $cprod = $registro['cprod'];
   $pbase = $registro['pbase'];
   $cenvio = $registro['cenvio'];
   $costo = $cantidad * $pbase;
   $envio  = $cantidad * $cenvio;
   $producto = $registro['producto']; 
   $sum = $pbase + $cenvio;
   $total = $sum * $cantidad; 

?>
<?
    $cid = $registro['cid'];
    $consulta = "SELECT * FROM clientes WHERE 'id' = '$cid'";
    $query2 = mysql_query($consulta);
    $array = mysql_fetch_array($query2);
    $establecimiento = $array['establecimiento'];
    $calle = $array['calle'];
    $numero = $array['numero'];
    $colonia = $array['colonia'];
    $cd = $array['ciudad'];

    $consulta3 = "SELECT * FROM regiones WHERE 'id' = '$cd'";
    $query3 = mysql_query($consulta3);
    $array3 = mysql_fetch_array($query3);
    $ciudad = $array3['ciudad'];
    $estado = $array3['estado'];

    $consulta4 = "SELECT * FROM productos WHERE 'id' = '$producto'";
    $query4 = mysql_query($consulta4);
    $array4 = mysql_fetch_array($query4);
    $nproducto = $array4['nombre'];

    ?>
<?php
require('fpdf/fpdf.php');

$pdf=new FPDF();
///var_dump(get_class_methods($pdf));

$pdf->AddPage();

$pdf->SetFont("Arial","B","13");
$pdf->Cell(0,10,"Cerveceria Montoro SA. de CV.",0,0,"L");
$pdf->SetFont("Arial","B","18");
$pdf->Cell(0,10,"Orden de Compra No. $factura",0,1,"R");
$pdf->SetFont("Arial","I","11");
$pdf->Cell(0,5,"Nacida Para Disfrutar.",0,0,"L");
$pdf->Ln(15);
$pdf->SetFont("Arial","B","11");
$pdf->Cell(0,5,"C. Camino Viejo a Calvillo",0,1,"L");
$pdf->Cell(0,5,"No. 517-A, Fracc. Villas de Monte Claro.",0,1,"L");
$pdf->Cell(0,5,"Jesus Maria, Aguascalientes. CP. 20994",0,1,"L");
$pdf->Cell(0,5,"Tel - (449)9049760",0,1,"L");
$pdf->Image('img/logo.png',130,25,50);
$pdf->Ln(20);
$pdf->SetFont("Arial","B","20");
$pdf->Cell(0,10,"$establecimiento",1,1);
$pdf->SetFont("Arial","","15");
$pdf->Cell(0,10,"$calle No. $numero, $colonia.",1,1);
$pdf->Cell(0,10,"$ciudad, $estado.",1,1);
$pdf->Ln(15);
$pdf->SetFont("Arial","B","13");
$pdf->Cell(0,10,"PEDIDO",1,1,"C");
$pdf->SetFont("Arial","B","10");
$pdf->Cell(30,10,"CANTIDAD",0,0);
$pdf->Cell(120,10,"DESCRIPCION",0,0);
$pdf->Cell(20,10,"COSTO",0,1);
$pdf->SetFont("Arial","","10");
$pdf->Cell(30,10,"$cantidad",0,0);
$pdf->Cell(120,10,"$nproducto",0,0);
$pdf->Cell(20,10,"$ $costo MXN.",0,1);
$pdf->Cell(30,10,"1",0,0);
$pdf->Cell(120,10,"Envio a $ciudad, $estado .",0,0);
$pdf->Cell(20,10,"$ $envio MXN.",0,1);
$pdf->Ln(15);
$pdf->Cell(170,10,"TOTAL: $ $total MXN.",0,1,"R");
$pdf->Output();
?>

I'll appreciate if you can give me some guidance :) Greetings!

    
asked by Guillermo Esquivel 15.02.2017 в 02:31
source

1 answer

0

You should try passing the necessary parameters to the FPDF OUTPUT () method ...

You can see the official documentation of the OUTPUT () method in:

link

Depending on what you want to do with the output, the first parameter can be:

I : if you want the browser to try to open the PDF.

D : if you want to pass it to the browser so that it starts a download of the file with the name set in the second parameter.

F : save the local cone file (ie on the server, you should be careful with this option since in the server folder you must have the permissions in 777, otherwise you will not save anything).

S : produces the output as a string.

For example:

$pdf->Output('D','archivo.pdf');

causes the browser to start downloading the pdf output into a file called "file.pdf"

I hope it serves you. Greetings!

    
answered by 15.02.2017 / 03:41
source