Ver Mensaje Individual
  #18 (permalink)  
Antiguo 20/05/2011, 05:57
pabloaguero2010
 
Fecha de Ingreso: mayo-2011
Ubicación: La Luna
Mensajes: 84
Antigüedad: 13 años
Puntos: 6
Respuesta: Crear PDF a partir de datos mysql en PHP

Cita:
Iniciado por Pepe_1988 Ver Mensaje
Perdona que te moleste... Sólo quiero solucionar mi gran problema, te juro que cuando lo termine no te preguntaré nada más. Vamos a ver cómo concateno yo ese script php??????? Lo he intentado concatenar y me sigue tirando errores



$html ="<html><head><title></title></head>
<body><center>Cesta de $usu<table align='center'><tr><td>$total €</td></tr></table>
".
print '<table><tr><th>Nombre de los cursos en tu cesta</th><th>Precio</th></tr>';

for ($i=0;$i<$nfilas;$i++)
{
$resultado=mysql_fetch_array($consulta2);
print '<tr><td>'.$resultado['nombrecur'].'</td><td>'.$resultado['preciocur'].'€</td></tr>';
}
print '<tr><td><span>El precio total es:</span></td><td><span>'.$respuesta2['preciototal'].'€</span></td></tr>';


print '</table><br></br>';


if ($nfilas2!="")
{
print '<table><tr><th>Nombre de los materiales en tu cesta</th><th>Precio</th></tr>';

for ($i2=0;$i2<$nfilas2;$i2++)
{
$resultado2=mysql_fetch_array($consulta3);
print '<tr><td>'.$resultado2['nombremat'].'</td><td>'.$resultado2['preciouni'].'€</td></tr>';
}
print '<tr><td><span>El precio total es:</span></td><td><span>'.$respuesta3['preciototalmat'].'€</span></td></tr>';

}


print '</body></html>;'."";


$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("sample.pdf");



Este es el error que me tira:

Fatal error: Uncaught exception 'PDFlibException' with message 'Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\eclipse\Proyecto Integrado\web\pdf02.php:41)' in C:\xampp\htdocs\eclipse\Proyecto Integrado\lib\include\pdflib_adapter.cls.php:833 Stack trace: #0 C:\xampp\htdocs\eclipse\Proyecto Integrado\lib\include\pdflib_adapter.cls.php(833): header('Cache-Control: ...') #1 C:\xampp\htdocs\eclipse\Proyecto Integrado\lib\include\dompdf.cls.php(447): PDFLib_Adapter->stream('sample.pdf', NULL) #2 C:\xampp\htdocs\eclipse\Proyecto Integrado\web\pdf02.php(70): DOMPDF->stream('sample.pdf') #3 {main} thrown in C:\xampp\htdocs\eclipse\Proyecto Integrado\lib\include\pdflib_adapter.cls.php on line 833

Tio viste el link que te deje
http://es.scribd.com/doc/55879554/Creacion-de-Reportes-Usando-Jasper-Soft-Ireport