Pablo Servin
Pablo Servin

Reputation: 7

Using tcpdf I have an error but I cant find it

I am trying to convert a html table into pdf, I am using TCPDF but when I am executing it the website show this error (Parse error: syntax error, unexpected '<' in /home2/ecovomxp/public_html/cotizador/pdf.php on line 87) can someone help me with finding the error ?

$html = '
<table>
    <thead>
        <tr>
            <th>Tecnología</th>
            <th>Norma de especificación</th>
            <th>Imagen</th>
            <th>Marca</th>
            <th>Modelo</th>
            <th>Descripción</th>
            <th>Precio unitario</th>
            <th>IVA</th>
            <th>Instalación</th>
            <th>Costo total</th>
            <th>Garantía</th>
            <th>Cotizar</th>
        </tr>
    </thead>
    <tbody>';

            $i = 0;
            foreach($records as $r) {

        $html .= '<tr>
            <td>'.<?php echo escape($r->tecnologia); ?>.'</td>
            <td>'.<?php echo escape($r->normaespecificacion); ?>.'</td>
            <td><img src="functions/'.<?php echo escape($r->foto); ?>.'"></td>
            <td>'.<?php echo escape($r->marca); ?>.'</td>
            <td>'.<?php echo escape($r->modelo); ?>.'</td>  
            <td>'.<?php echo escape($r->descripcion); ?>.'</td>
            <td>$'.<?php echo escape($r->preciounitario); ?>.'</td>
            <td>$'.<?php echo escape($r->iva); ?>.'</td>
            <td>$'.<?php echo escape($r->instalacion); ?>.'</td>
            <td>$'.<?php echo escape($r->totalcosto); ?>.'</td>
            <td>'.<?php echo escape($r->garantia); ?>.'</td>
            <td><input type="text" value="0" class="imp"  size="2" /></td>
        </tr>';
            <?php
            $i = $i+1;
            }
            ?>             
    $html .= '</tbody>
</table>';

Upvotes: 0

Views: 259

Answers (1)

user3335966
user3335966

Reputation: 2745

As say Geoffrey Mureithi - it's a syntax error -

enter image description here

$i = 0;
foreach($records as $r) {

$html .= '<tr>
    <td>'.escape($r->tecnologia).'</td>
    <td>'.escape($r->normaespecificacion).'</td>
    <td><img src="functions/'.escape($r->foto).'"></td>
    <td>'.escape($r->marca).'</td>
    <td>'.escape($r->modelo).'</td>  
    <td>'.escape($r->descripcion).'</td>
    <td>$'.escape($r->preciounitario).'</td>
    <td>$'.escape($r->iva).'</td>
    <td>$'.escape($r->instalacion).'</td>
    <td>$'.escape($r->totalcosto).'</td>
    <td>'.escape($r->garantia).'</td>
    <td><input type="text" value="0" class="imp"  size="2" /></td>
    </tr>';
    $i = $i+1;
}

Upvotes: 1

Related Questions