2014-11-06 3 views
0

.pdf 파일을 생성하려고합니다. 하지만 난 내 텍스트를 연결할 수 없습니다 이 내 코드입니다 : 내가 추가해야DOMPDF가 잘못된 pdf

Nombre del cliente: <input type="text" value="'; //HERE I'M TRYING TO CONCATENATE 
echo $datocli['nomempresacli']; 
$codigoHTML=' 
"> 

:

<?php 
include('conexion.php'); 
$con = conexion(); 
$sql="select * from [my table] where [condition] "; 
$res=mysql_query($sql,$con); 

$concli=conexion(); 
$sqlcli="select * from [my table] where [condition]"; 

$rescli=mysql_query($sqlcli,$concli); 
$datocli=mysql_fetch_array($rescli); 
$codigoHTML=' 
<!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=ISO-8859-1" /> 
<title>PDF</title> 
</head> 
<body> 

<form> 
<div align="left"> 
<img src="images/logo.jpg" width="186" height="88" alt="playss.net"/> </div><br/> 
<hr /> 
<div > 
<pre> 
Nombre del cliente: <input type="text" value="'; //HERE I'M TRYING TO CONCATENATE 
echo $datocli['nomempresacli']; 
$codigoHTML=' 
"> 
Nombre del Vendedor <input type="text" value=""> 
Proyecto:   <input type="text" > 
Fecha:    <input type="text" > 
</pre> 
<table width="95%" height="100%" border="1"> 
<tr height="40"> 
<td>#</td> 
<td >Id Producto</td> 
<td >Parte</td> 
<td >Descripci&oacute;n</td> 
<td >Cantidad</td> 
<td >Precio</td> 
<td >Subtotal</td> 
<td >Descuento</td> 
<td >total</td> 
</tr>'; 
require_once("dompdf/dompdf_config.inc.php"); 

$contador=1; 

while ($dato=mysql_fetch_array($res)) 
{ 
$codigoHTML.=' 
     <tr> 
     <td>'.$contador.'</td> 
     <td>'.$dato['idproducto'].'</td> 
     <td>'.$dato['parte'].'</td> 
     <td>'.$dato['descripcion'].'</td> 
     <td>'.$dato['cantidad'].'</td> 
     <td>'.$dato['precio'].'</td> 
     <td>'.$dato['subtotal'].'</td> 
     <td>'.$dato['descuento'].'</td> 
     <td>'.$dato['total'].'</td> 
     </tr>'; 
     $contador++; 
     } 
$codigoHTML.=' 
    </table> 
</div> 
<pre> 
<div align="right"> 
Total Final: <input type="text" > 
</div> 
</pre> 
<br/> 
<hr/> 


</form> 

</body> 
</html> 
'; 

$codigoHTML=utf8_decode($codigoHTML); 
$dompdf=new DOMPDF(); 
$dompdf->load_html($codigoHTML); 

ini_set("memory_limit","128M"); 
$dompdf->render(); 
$dompdf->stream("cotizacion.pdf"); 
?> 

img

나는 내가 가지고있는 실수는 다음 라인에 생각 이 줄이 더 많지만 하나에서 작동하지 않으면 더 이상 작동하지 않습니다

누군가 나를 도울 수 있습니까?

사용이 같이 :

+1

** 경고 ** : 'mysql_query'는 사용되지 않는 인터페이스와 사용하지 않아야합니다 새로운 응용 프로그램에서는 PHP의 이후 버전에서 제거 될 예정입니다. [PDO와 같은 현대적인 대체물은 배우기 어렵지 않습니다.] (http://net.tutsplus.com/tutorials/php/why-you-should-be-using-phps-pdo-for-database-access/). PHP를 처음 사용하는 분이라면 [PHP The Right Way] (http://www.phptherightway.com/)와 같은 안내서가 모범 사례를 설명하는 데 도움이 될 것입니다. – tadman

+0

@ tadman 감사 말씀 드리겠습니다. –

+0

아무 것도 추가/연결하지 않습니다. '$ codigoHTML' 변수를 다시 할당하고 있습니다. 추가/연결하려면'$ codigoHTML. = "some text";'와 같이'. = '연산자를 사용하여 할당하십시오. 또한, 변수를 반향 출력하면 출력으로 사용자에게 보내지 만 문자열에는 추가되지 않습니다. 변수와 함께'. ='를 사용하여 추가 할 수 있습니다. –

답변

0

오류는 더 제대로 최종 HTML 결과를 contactenating있다 없다

Nombre del cliente: <input type="text" value="'; //HERE I'M TRYING TO CONCATENATE 
$codigoHTML.= $datocli['nomempresacli']; 
$codigoHTML.= ' 
"> 
Nombre del Vendedor <input type="text" value=""> 
Proyecto:   <input 
관련 문제