Foros del Web » Programando para Internet » PHP »

fpdf y consulta mysql

Estas en el tema de fpdf y consulta mysql en el foro de PHP en Foros del Web. Código PHP: <?php require( 'RUM.php' ); //Connect to your database include( "../../../controllers/conexion.php" ); //Select the Products you want to show in your PDF file $result = mysql_query ( "SELECT PROD_CODI, PROD_NOMB, UMED_CODI FROM CSTO_PROD" , $con ); $number_of_products  =  mysql_numrows ( $result ); ...
  #1 (permalink)  
Antiguo 04/09/2011, 18:51
 
Fecha de Ingreso: marzo-2009
Mensajes: 356
Antigüedad: 15 años, 1 mes
Puntos: 7
fpdf y consulta mysql

Código PHP:
<?php
require('RUM.php');

//Connect to your database
include("../../../controllers/conexion.php");

//Select the Products you want to show in your PDF file
$result=mysql_query("SELECT PROD_CODI, PROD_NOMB, UMED_CODI FROM CSTO_PROD",$con);
$number_of_products mysql_numrows($result);

//Initialize the 3 columns and the total
$column_code "";
$column_name "";
$column_desc "";
$total 0;

//For each row, add the field to the corresponding column
while($row mysql_fetch_array($result))
{
    
$UMED_CODI  $row["PROD_CODI"];
    
$UMED_NOMB  $row["PROD_NOMB"];
    
$UMED_DESC  $row["UMED_CODI"];

    
$column_code $column_code.$UMED_CODI."\n";
    
$column_name $column_name.$UMED_NOMB."\n";
    
$column_desc $column_desc.$UMED_DESC."\n";
}
mysql_close();

//Create a new PDF file

$pdf=new RUM();

$pdf->AddPage();

//Fields Name position
$Y_Fields_Name_position 40;
//Table position, under Fields Name
$Y_Table_Position 46;

//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(20);
$pdf->Cell(20,6,'Codigo',1,0,'L',1);
$pdf->SetX(40);
$pdf->Cell(130,6,'Nombre',1,0,'L',1);
//$pdf->SetX(60);
//$pdf->Cell(40,6,'Descripcion',1,0,'L',1);
$pdf->Ln();

//Now show the 3 columns
$pdf->SetFont('Arial','',12);
$pdf->SetY($Y_Table_Position);
$pdf->SetX(20);
//$pdf->MultiCell(20,6,$column_code,1);
$pdf->SetY($Y_Table_Position);
$pdf->SetX(40);
$pdf->MultiCell(130,6,$column_name,1);
//$pdf->SetY($Y_Table_Position);
//$pdf->SetX(60);
//$pdf->MultiCell(40,6,$column_desc,1);

//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(20);
    
$pdf->MultiCell(170,6,'',1);
    
$i $i +1;
}
$pdf->Output();
?>
tengo aproximadamente 1000 registros, Codigo Producto, Nombre Prod, Descripcion Producto.

Lo malo es que primero reporta los 1000 registros con el codigo, luego 1000 con nombre , 1000 con descripcion, cuando debe tomar todo al mismo tiempo.

no se a que se deba. espero ayuda urgente gracias.
  #2 (permalink)  
Antiguo 04/09/2011, 20:50
 
Fecha de Ingreso: marzo-2009
Mensajes: 356
Antigüedad: 15 años, 1 mes
Puntos: 7
Respuesta: fpdf y consulta mysql

El problema ocurre cuando paso a la siguiente pagina. si solo tiene 1 pagina no hay problema alguno.

Etiquetas: fpdf, mysql, registro, sql
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 11:26.