Ver Mensaje Individual
  #1 (permalink)  
Antiguo 31/08/2011, 14:16
dante14
 
Fecha de Ingreso: marzo-2009
Mensajes: 356
Antigüedad: 15 años, 1 mes
Puntos: 7
Problema con fpdf

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();
?>
no entiendo porque primero me reporta el codigo, luego nombre.
tengo 1500 productos; pero primero me reporta los 1500 codigos, luego abajo de estos me reporta los 1500 nombres y asi, no todo en una sola fila. eso es lo raro. alguien q me ayude?