• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
domPDF dinamic data sintax (PDF print)

#1
[eluser]Nicemotion[/eluser]
Just realized i posted in a solved thread... re-post as new topic here...

Dear all,
All works perfectly but the dynamic data (lol).. it gives me a sintax T_STRING error in the query echo lines tho the html is correct on a normal html page...

Any idea ?
Ty in advance

Code:
<?php
require_once('Connections/tao_conn.php');

mysql_select_db($database_tao_conn, $tao_conn);
$query_Pagamenti = "SELECT * FROM pagamenti  INNER JOIN iscrizioni ON pagamenti.iscrizioni_idiscrizioni = iscrizioni.idiscrizioni  INNER JOIN utenti ON iscrizioni.utenti_idutenti = utenti.idutenti  LEFT JOIN fatture_has_pagamenti ON fatture_has_pagamenti.pagamenti_idpagamenti = pagamenti.idpagamenti  LEFT JOIN fatture ON fatture.utenti_idutenti = iscrizioni.utenti_idutenti  INNER JOIN diz_iva ON diz_iva.iddiz_iva = fatture.diz_iva_iddiz_iva WHERE iscrizioni.utenti_idutenti = utenti.idutenti";
$Pagamenti = mysql_query($query_Pagamenti, $tao_conn) or die(mysql_error());
$row_Pagamenti = mysql_fetch_assoc($Pagamenti);
$totalRows_Pagamenti = mysql_num_rows($Pagamenti);

require_once("resources/dompdf/dompdf_config.inc.php");
$filename = "pdf_test";
$html ='<html><body>'.
  '<table width="100%" border="0">
        <tr>
          <td>ID Pago</td>
          <td>Importo</td>
          <td>Data</td>
          <td>Descrizione</td>
          <td>IVA %</td>
          <td>IVA</td>
           </tr>
        &lt;?php do { ?&gt;
           <tr>
###  following 5 lines gives problem ###
             <td>&lt;?php echo $row_Pagamenti['idpagamenti']; ?&gt;</td>
             <td>&lt;?php echo $row_Pagamenti['pagatoimporto']; ?&gt;</td>
             <td>&lt;?php echo $row_Pagamenti['pagatodata']; ?&gt;</td>
             <td>&lt;?php echo $row_Pagamenti['descpago']; ?&gt;</td>
             <td>&lt;?php echo $row_Pagamenti['iva_pct']; ?&gt;</td>
             <td>&nbsp;</td>
              </tr>
          &lt;?php } while ($row_Pagamenti = mysql_fetch_assoc($Pagamenti)); ?&gt;
                  </table>'.
  '&lt;/body&gt;&lt;/html>';

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

?&gt;

#2
[eluser]Massaki[/eluser]
Code:
$html ='&lt;html&gt;&lt;body>'.
  '<table width="100%" border="0">
        <tr>
          <td>ID Pago</td>
          <td>Importo</td>
          <td>Data</td>
          <td>Descrizione</td>
          <td>IVA %</td>
          <td>IVA</td>
           </tr>';
do {
$html .= '
           <tr>
             <td>' . $row_Pagamenti['idpagamenti'] . '</td>
             <td>' . $row_Pagamenti['pagatoimporto'] . '</td>
             <td>' . $row_Pagamenti['pagatodata'] . '</td>
             <td>' . $row_Pagamenti['descpago'] . '</td>
             <td>' . $row_Pagamenti['iva_pct'] . '</td>
             <td>&nbsp;</td>
              </tr>';
} while ($row_Pagamenti = mysql_fetch_assoc($Pagamenti));

$html .= '
                  </table>'.
  '&lt;/body&gt;&lt;/html>';

#3
[eluser]Nicemotion[/eluser]
Perfect ! Tyvm Massaki !!

#4
[eluser]CroNiX[/eluser]
Code:
$row_Pagamenti = mysql_fetch_assoc($Pagamenti)
Why wouldn't you use CI's db object?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.