Tema: Mpdf y MySql
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/01/2012, 08:33
visona
 
Fecha de Ingreso: febrero-2008
Mensajes: 675
Antigüedad: 16 años, 3 meses
Puntos: 5
Mpdf y MySql

Buenas a todos.
Tengo un problema que no encuentro la solucion.
Intento crear un PDF y que me de el listado de un campo de una base de datos.
Lo quiero imprimir en una web con MFPF. El caso es que saco el PDF, pero no se como sacar el while de un campo para que me imprima los resultados.

Código PHP:
$colname_codigos "-1";
if (isset(
$_GET['id'])) {
  
$colname_codigos $_GET['id'];
}
mysql_select_db($database_juntos$juntos);
$query_codigos sprintf("SELECT * FROM ventas WHERE idarticulos = %s"GetSQLValueString($colname_codigos"text"));
$codigos mysql_query($query_codigos$juntos) or die(mysql_error());
$row_codigos mysql_fetch_assoc($codigos);
$totalRows_codigos mysql_num_rows($codigos);
$pintar =$row_codigos['codigo_venta'];

$mpdf=new mPDF();

$mpdf->WriteHTML('
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>

<style type="text/css">

.descripcion {
    background-color: #FFBD9D;
}
.fondo {
}
.linea {
    border-top-width: 1px;
    border-top-style: dashed;
    border-top-color: #999;
}
</style>
</head>

<body>
<table width="620" border="0" cellpadding="0" cellspacing="0">
<tr>
    <td width="210" bgcolor="#FFFFCC"><img src="http://www.mitijeretazo.com/images/logo.png" alt=""  height="57" /></td>
    <td width="410" align="center" bgcolor="#FFFFCC"><span class="tijeretazo" style="font-size: 24px; font-weight: bold;">Impresiones de códigos</span></td>
  </tr>

    
</table>
<hr align="left" width="620" size="1" noshade="noshade" class="linea" />
<table width="620" border="0" cellpadding="0" cellspacing="0" >
  <tr>
    <td>Promoción: '
.$_GET['id'].'</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
 <tr>
    <td width="601">Códigos validados: '
.$pintar.'<br />
    </td>
  </tr> 
</table>
<hr align="left" width="620" size="1" noshade="noshade" class="linea" />
<table width="620" border="0" cellpadding="0" cellspacing="0" >
  <tr>
    <td width="601">    <  td>
  </tr>
</table>
<p>&nbsp;</p>
</body>
</html>
'
);
$mpdf->SetHTMLFooter('
<table width="650" style="vertical-align: bottom; font-family: serif; font-size: 8pt; color: #000000; font-weight: bold; font-style: italic;"><tr>
<td width="33%"><span style="font-weight: bold; font-style: italic;">{DATE j-m-Y}</span></td>
<td width="33%" align="center" style="font-weight: bold; font-style: italic;">{PAGENO}/{nbpg}</td>
<td width="33%" style="text-align: right; "></td>
</tr></table>
'
);
$mpdf->Output('../pdf/'.$_GET['codigo'].'.pdf''I'); 
Alguien me puede indicar como hacerlo?.

Un saludo y gracias

Última edición por visona; 27/01/2012 a las 08:53