15/11/2006, 16:07
|
| | | Fecha de Ingreso: octubre-2006 Ubicación: La Paz
Mensajes: 391
Antigüedad: 18 años, 1 mes Puntos: 16 | |
help hola
miren tengo unproblema con este codigo que genera reportes en pdf con la libreria fpdf ç Código PHP: <?php
//SHOW A DATABASE ON A PDF FILE
//FILE CREATED BY: Carlos José Vásquez Sáez
//YOU CAN CONTACT ME: [email protected]
//FROM PUNTA ARENAS, MAGALLANES
define('FPDF_FONTPATH','font/');
require('fpdf.php');
//Connect to your database
include("conexion.php");
$link=Conectarse();
//Select the Products you want to show in your PDF file
//$result=mysql_query("select * form pgeren",$link);
$result=mysql_query("select Id,id_quimico,fechaped from pgeren",$link);
$number_of_products = mysql_num_rows($result);
//Initialize the 3 columns and the total
$column_code = "";
$column_name = "";
$column_price = "";
$total = 0;
//For each row, add the field to the corresponding column
while($row = mysql_fetch_array($result))
{
$code = $row["Id"];
$name = substr($row["Id"],0,20);
$real_price = $row["Id"];
$price_to_show = number_format($row["Id"],',','.','.');
$column_code = $column_code.$code."\n";
$column_name = $column_name.$name."\n";
//$column_price = $column_price.$price_to_show."\n";
//Sum all the Prices (TOTAL)
$total = $total+$real_price;
}
mysql_close();
//Convert the Total Price to a number with (.) for thousands, and (,) for decimals.
$total = number_format($total,',','.','.');
//Create a new PDF file
$pdf=new FPDF();
$pdf->Open();
$pdf->AddPage();
//Fields Name position
$Y_Fields_Name_position = 20;
//Table position, under Fields Name
$Y_Table_Position = 26;
//First create each Field Name
//Gray color filling each Field Name box
$pdf->SetFillColor(232,232,232);
//Bold Font for Field Name
$pdf->SetFont('Arial','B',12);
$pdf->SetY($Y_Fields_Name_position);
$pdf->SetX(45);
$pdf->Cell(20,6,'CODE',1,0,'L',1);
$pdf->SetX(65);
$pdf->Cell(100,6,'NAME',1,0,'L',1);
$pdf->SetX(135);
$pdf->Cell(30,6,'PRICE',1,0,'R',1);
$pdf->Ln();
//Now show the 3 columns
$pdf->SetFont('Arial','',12);
$pdf->SetY($Y_Table_Position);
$pdf->SetX(45);
$pdf->MultiCell(20,6,$column_code,1);
$pdf->SetY($Y_Table_Position);
$pdf->SetX(65);
$pdf->MultiCell(100,6,$column_name,1);
$pdf->SetY($Y_Table_Position);
$pdf->SetX(135);
$pdf->MultiCell(30,6,$columna_price,1,'R');
$pdf->SetX(135);
$pdf->MultiCell(30,6,'$ '.$total,1,'R');
//Create lines (boxes) for each ROW (Product)
//If you don't use the following code, you don't create the lines separating each row
$i = 0;
$pdf->SetY($Y_Table_Position);
while ($i < $number_of_products)
{
$pdf->SetX(45);
$pdf->MultiCell(120,6,'',1);
$i = $i +1;
}
$pdf->Output();
?> me sale el siguiente error
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\REPORTES\conexion.php:22) in C:\AppServ\www\REPORTES\fpdf.php on line 1022
FPDF error: Some data has already been output to browser, can't send PDF file
que esta mal ayuda por fa |