Foros del Web » Programando para Internet » PHP »

enviar a pdf variables de la base de datos

Estas en el tema de enviar a pdf variables de la base de datos en el foro de PHP en Foros del Web. hola ke tal, como estan? quisiera pedir su ayuda una ves maz es ke pues, kier sacar unos datos ke insertan en la base de ...
  #1 (permalink)  
Antiguo 02/10/2008, 09:25
 
Fecha de Ingreso: septiembre-2008
Mensajes: 58
Antigüedad: 15 años, 7 meses
Puntos: 0
enviar a pdf variables de la base de datos

hola ke tal, como estan?
quisiera pedir su ayuda una ves maz

es ke pues, kier sacar unos datos ke insertan en la base de datos y no me sale en el pdf,
solamente me salen las que ya estan en la base, como, el nombre, numero, telefono, etc
y poes lo que es unidad, descripcion, total subtotal, etc, no salen. y pues kisiera saber si ay un codigo para llamar a estos que son los que recien inserttan?
ake esta el codigo ke tengo asta aorita para el pdf.
Código php:
Ver original
  1. <?php require_once('Connections/facturas.php'); ?>
  2. <?php
  3. if (!function_exists("GetSQLValueString")) {
  4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  5. {
  6.   $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  7.  
  8.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  9.  
  10.   switch ($theType) {
  11.     case "text":
  12.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  13.       break;    
  14.     case "long":
  15.     case "int":
  16.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  17.       break;
  18.     case "double":
  19.       $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
  20.       break;
  21.     case "date":
  22.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  23.       break;
  24.     case "defined":
  25.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  26.       break;
  27.   }
  28.   return $theValue;
  29. }
  30. }
  31. ?><?php
  32. require_once('Connections/facturas.php');
  33. require('pdfclass/class.ezpdf.php');?>
  34. <?php
  35. if (!function_exists("GetSQLValueString")) {
  36. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  37. {
  38.   $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  39.  
  40.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  41.  
  42.   switch ($theType) {
  43.     case "text":
  44.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  45.       break;    
  46.     case "long":
  47.     case "int":
  48.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  49.       break;
  50.     case "double":
  51.       $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
  52.       break;
  53.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  54.       break;
  55.     case "defined":
  56.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  57.       break;
  58.   }
  59.   return $theValue;
  60. }
  61. }
  62.  
  63. $colname_fact = "-1";
  64. if (isset($_GET['id'])) {
  65.  $colname_fact = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
  66. }
  67. mysql_select_db($database_facturas, $facturas);
  68. $query_fact = sprintf("SELECT * FROM cliente_fac WHERE id = %s ORDER BY nom_clien ASC", GetSQLValueString($colname_fact, "int"));
  69. $fact = mysql_query($query_fact, $facturas) or die(mysql_error());
  70. $row_fact = mysql_fetch_assoc($fact);
  71. $totalRows_fact = mysql_num_rows($fact);
  72.  
  73. $colname_Recordset1 = "-1";
  74. if (isset($_GET['id'])) {
  75.   $colname_Recordset1 = $_GET['id'];
  76. }
  77. mysql_select_db($database_facturas, $facturas);
  78. $query_Recordset1 = sprintf("SELECT * FROM variables WHERE id = %s ORDER BY id DESC", GetSQLValueString($colname_Recordset1, "int"));
  79. $Recordset1 = mysql_query($query_Recordset1, $facturas) or die(mysql_error());
  80. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  81. $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  82.  
  83. $x2=$row_fact['nom_clien'];
  84. $x3=$row_fact['dom_clien'];
  85. $x4=$row_fact['ciud_clien'];
  86. $x5=$row_fact['tel_clien'];
  87. $x6=$row_fact['rfc_clien'];
  88. $x7=$row_fact['no_clien'];
  89. $x8=$row_Recordset1['fac_dia'];
  90. $x9=$row_Recordset1['fac_mes'];
  91. $x10=$row_Recordset1['fac_fecha'];
  92. $x11=$row_Recordset1['fac_cantidad'];
  93. $x12=$row_Recordset1['fac_unidad'];
  94. $x13=$row_Recordset1['fac_desc'];
  95. $x14=$row_Recordset1['fac_p_unitario'];
  96. $x15=$row_Recordset1['fac_importe'];
  97. $x16=$row_Recordset1['fac_impcletra'];
  98.  
  99. $pdf =& new Cezpdf();
  100. $pdf->selectFont('includes/pdfclass/fonts/Helvetica.afm');
  101. $pdf->addJpegFromFile('facturacarpi.jpg',25,50,550);
  102. $pdf->ezSetY(660);
  103. $pdf->ezText("                            ".$x2."      ".$x8."    ".$x9."    ".$x10);
  104. $pdf->ezSetY(655);
  105. $pdf->ezSetY(640);
  106. $pdf->ezText("                            ".$x3);
  107. $pdf->ezSetY(620);
  108. $pdf->ezText("                            ".$x4);
  109. $pdf->ezSetY(604);
  110. $pdf->ezText("                     ".$x5."                         ".$x6."                         ".$x7);
  111. $pdf->ezSetY(540);
  112. $pdf->ezText("      ".$x12."           ".$x12."           ".$x13."            ".$x14."                 ".$x15);
  113.  
  114. $pdf->ezStream();
  115.  
  116. mysql_free_result($Recordset1);
  117. ?>
gracias por su ayuda, se les agradece
  #2 (permalink)  
Antiguo 02/10/2008, 15:02
Avatar de kaninox  
Fecha de Ingreso: septiembre-2005
Ubicación: In my House
Mensajes: 3.597
Antigüedad: 18 años, 7 meses
Puntos: 49
Respuesta: enviar a pdf variables de la base de datos

no entiendo mucho tu duda dices que si te funciona para nombres y demas
mi pregunta es.. por que no te resulta entonces para los demas??? :/
ahora si quieres por ejemplo generaste un pdf y despues ingreso datos estos se reflejen deberias actualizar de alguna manera el archivo, :/ asi de forma automatica no le veo la forma...

saludos
__________________
Gokuh Salvo al mundo. PUNTO!!!!
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 02:53.