Foros del Web » Programando para Internet » PHP »

Mostrar datos php en fpdf

Estas en el tema de Mostrar datos php en fpdf en el foro de PHP en Foros del Web. Estoy tratando de mostrar datos específicos de una base de datos en un pdf, usando fpdf. esta es mi consulta @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); Código PHP: Ver ...
  #1 (permalink)  
Antiguo 22/11/2013, 12:37
 
Fecha de Ingreso: noviembre-2013
Mensajes: 13
Antigüedad: 10 años, 5 meses
Puntos: 0
Pregunta Mostrar datos php en fpdf

Estoy tratando de mostrar datos específicos de una base de datos en un pdf, usando fpdf.
esta es mi consulta

Código PHP:
Ver original
  1. $domingos_mostrar_domingos = "0";
  2. if (isset($_GET["domingo"])) {
  3.   $domingos_mostrar_domingos = $_GET["domingo"];
  4. }
  5. mysql_select_db($database_conexion, $conexion);
  6. $query_mostrar_domingos = sprintf("SELECT * FROM minuta WHERE minuta.fecha = %s  AND minuta.nombre='NUMERO 1'", GetSQLValueString($domingos_mostrar_domingos, "int"));
  7. $mostrar_domingos = mysql_query($query_mostrar_domingos, $conexion) or die(mysql_error());
  8. $row_mostrar_domingos = mysql_fetch_assoc($mostrar_domingos);
  9. $totalRows_mostrar_domingos = mysql_num_rows($mostrar_domingos);


Lo que estoy haciendo es pasar una variable de una pagina anterior por metodo GET es esta:

Código HTML:
Ver original
  1. <div id="div_p_botones1">
  2. <a href="generar_PDF.php?domingo=<?php echo $_GET["domingo"];?>"><span class="button_1" style="cursor:pointer;"><img src="../images/Iconos/grafico_menu.png" alt="" width="30" height="26" align="absmiddle" />   Generar PDF</span></a>
  3. </div>

Formato en que mando la fecha es aaaa-mm-dd

Pero solo me muestra la tabla vacía, no muestra nada al poner en

Código PHP:
Ver original
  1. $this->Cell(45,6,"Adultos",'LR',0,'L',$fill);
  2.     $this->Cell(45,6,''.$row_mostrar_domingos['num_1'],'LR',0,'C',$fill);
  3.     $this->Cell(45,6,"Adultos",'LR',0,'L',$fill);
  4.     $this->Cell(45,6,"",'LR',0,'C',$fill);
  5.     $this->Ln();
  6.           $fill=!$fill;
  7.     $this->Cell(45,6,"Niños",'LR',0,'L',$fill);
  8.     $this->Cell(45,6,''.$row_mostrar_domingos['num_2'],'LR',0,'C',$fill);
  9.     $this->Cell(45,6,"Niños",'LR',0,'L',$fill);
  10.     $this->Cell(45,6,"",'LR',0,'C',$fill);
  11.     $fill=true;
  12.     $this->Ln();
  13.           $fill=!$fill;
  14.     $this->Cell(45,6,"Visitas",'LR',0,'L',$fill);
  15.     $this->Cell(45,6,"".$row_mostrar_domingos['num_3'],'LR',0,'C',$fill);
  16.     $this->Cell(45,6,"Visitas",'LR',0,'L',$fill);
  17.     $this->Cell(45,6,"",'LR',0,'C',$fill);
  18.     $fill=false;
  19.     $this->Ln();
  20.           $fill=!$fill;
  21.     $this->Cell(45,6,"Total",'LR',0,'L',$fill);
  22.     $this->Cell(45,6,"".$row_mostrar_domingos['total'],'LR',0,'C',$fill);
  23.     $this->Cell(45,6,"Total",'LR',0,'L',$fill);
  24.     $this->Cell(45,6,"",'LR',0,'C',$fill);

El resto del Codigo es este

Código PHP:
Ver original
  1. <?php
  2. require ('../Scripts/fpdf/fpdf.php');
  3. require_once('../Connections/conexion.php');
  4.  
  5.  
  6.  
  7. class PDF extends FPDF{
  8. public function Header(){
  9.         $this->Image('../images/banner.JPG');
  10.         $this-> SetFont ('Arial','B',18);
  11.         $this->Ln(5);
  12.         $this->SetTextColor(0,0,139);
  13.         $this->Cell(190,10,'Día '.$_GET["domingo"],0,0,'C');
  14.         /*$this-> Cell(190,10,'Multiforma',0,0,'C');*/
  15.         $this-> Ln(10);
  16.         }
  17.  
  18.     //Tabla coloreada
  19. function TablaColores($header)
  20. {
  21.     $row_mostrar_domingos =isset($_REQUEST['row_mostrar_domingos']);
  22. //Colores, ancho de línea y fuente en negrita
  23.     $this->SetFillColor(25,25,112);
  24.     $this->SetTextColor(255);
  25.     $this->SetDrawColor(0,0,0);
  26.     $this->SetLineWidth(.3);
  27.     $this->SetFont('Arial','B',14);
  28. //Cabecera
  29.  
  30.  
  31.     for($i=0;$i<count($header);$i++)
  32.     $this->Cell(45,7,$header[$i],1,0,'C',1);
  33.     $this->Ln();
  34.     //Restauración de colores y fuentes
  35.     $this->SetFillColor(224,235,255);
  36.     $this->SetTextColor(0,0,0);
  37.     $this->SetFont('Courier','',12);
  38.     //Datos
  39.        $fill=false;
  40.     $this->Cell(45,6,"Adultos",'LR',0,'L',$fill);
  41.     $this->Cell(45,6,''.$row_mostrar_domingos['num_1'],'LR',0,'C',$fill);
  42.     $this->Cell(45,6,"Adultos",'LR',0,'L',$fill);
  43.     $this->Cell(45,6,"",'LR',0,'C',$fill);
  44.     $this->Ln();
  45.           $fill=!$fill;
  46.     $this->Cell(45,6,"Niños",'LR',0,'L',$fill);
  47.     $this->Cell(45,6,''.$row_mostrar_domingos['num_2'],'LR',0,'C',$fill);
  48.     $this->Cell(45,6,"Niños",'LR',0,'L',$fill);
  49.     $this->Cell(45,6,"",'LR',0,'C',$fill);
  50.     $fill=true;
  51.     $this->Ln();
  52.           $fill=!$fill;
  53.     $this->Cell(45,6,"Visitas",'LR',0,'L',$fill);
  54.     $this->Cell(45,6,"".$row_mostrar_domingos['num_3'],'LR',0,'C',$fill);
  55.     $this->Cell(45,6,"Visitas",'LR',0,'L',$fill);
  56.     $this->Cell(45,6,"",'LR',0,'C',$fill);
  57.     $fill=false;
  58.     $this->Ln();
  59.           $fill=!$fill;
  60.     $this->Cell(45,6,"Total",'LR',0,'L',$fill);
  61.     $this->Cell(45,6,"".$row_mostrar_domingos['total'],'LR',0,'C',$fill);
  62.     $this->Cell(45,6,"Total",'LR',0,'L',$fill);
  63.     $this->Cell(45,6,"",'LR',0,'C',$fill);
  64.     $fill=true;
  65.        $this->Ln();
  66.        $this->Cell(180,0,'','T');
  67. }
  68.  
  69. }
  70.  
  71. $pdf = new PDF ();
  72. $pdf-> AddPage();
  73.  
  74.  
  75.  
  76. //Títulos de las columnas
  77. $pdf->SetFont('Arial','B',18);
  78. $pdf->SetTextColor(255,255,0);
  79.  
  80. $header=array('NUMERO 1','Número','NUMERO 2','Número');
  81.  
  82.  
  83. $pdf->AliasNbPages();
  84. //Primera página
  85.  
  86. $pdf->SetY(50);
  87. //$pdf->AddPage();
  88. $pdf->TablaColores($header);
  89. $pdf->Ln(10);
  90.  
  91. $pdf->Output();
  92.  
  93. mysql_free_result($mostrar_domingos);
  94. ?>

Espero de su gran ayuda, por favor.
  #2 (permalink)  
Antiguo 22/11/2013, 13:07
Avatar de xSkArx  
Fecha de Ingreso: marzo-2008
Ubicación: Chile
Mensajes: 945
Antigüedad: 16 años, 1 mes
Puntos: 96
Respuesta: Mostrar datos php en fpdf

Las fechas no.son de tipo integer, puede que.ese sea tu problema
__________________
Busca, lee y practica todo lo que puedas.
Usa siempre el buscador antes de postear.
Si posteas código, utiliza el HIGHLIGHT correcto.
  #3 (permalink)  
Antiguo 26/11/2013, 09:56
 
Fecha de Ingreso: noviembre-2013
Mensajes: 13
Antigüedad: 10 años, 5 meses
Puntos: 0
Respuesta: Mostrar datos php en fpdf

Cita:
Iniciado por xSkArx Ver Mensaje
Las fechas no.son de tipo integer, puede que.ese sea tu problema
Ya cambie por date y ni así, podrían ayudarme con esto, ya no se que mas mover
  #4 (permalink)  
Antiguo 26/11/2013, 15:32
Avatar de xSkArx  
Fecha de Ingreso: marzo-2008
Ubicación: Chile
Mensajes: 945
Antigüedad: 16 años, 1 mes
Puntos: 96
Respuesta: Mostrar datos php en fpdf

Cambialo a string
__________________
Busca, lee y practica todo lo que puedas.
Usa siempre el buscador antes de postear.
Si posteas código, utiliza el HIGHLIGHT correcto.
  #5 (permalink)  
Antiguo 27/11/2013, 11:33
 
Fecha de Ingreso: noviembre-2013
Mensajes: 13
Antigüedad: 10 años, 5 meses
Puntos: 0
Respuesta: Mostrar datos php en fpdf

Pues no, aun asi no muestra los datos
Sigue mostrando la tabla vacia, y ya proble la consulta en otra interfaz y esta bien, espero que alguien me ayude, gracias por los que han respondido

Etiquetas: fpdf, mysql+consulta, mysql_fetch_assoc
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 17:32.