 |
รบกวนสอบถามการออกรายงาน TCPDF ให้เป็นตาราง ตาม 'html แล้ว ดึงข้อมูล จาก db ให้มาแสดงในตารางตาม html ที่สร้างไว้ครับ |
|
 |
|
|
 |
 |
|
Code (PHP)
<?
require('tcpdf/tcpdf.php');
include ('config.php'); //// Database ////
$pdf=new TCPDF();
$pdf->AddPage();
$pdf->AddFont('angsanaupc','','angsanaupc.php');
$pdf->SetFont('angsanaupc', '', 16);
$htmlcontent='
<table cellpadding="1" cellspacing="1" border="1" style="text-align:center;">
<tr>
<td><center>สถานะ</center></td>
<td><center>ชื่อ - สกุล</center></td>
<td><center>ทที่อยู่</center></td>
</tr></table>
';
$q="SELECT username FROM tb_person";
$qr=mysql_query($q);
while($rs=mysql_fetch_array($qr)){
$htmlcontent.=$rs['username']."<br/>";
echo"<tr><td>$htmlcontent[sex]</td>";
echo"<td>$htmlcontent[n_name]- $htmlcontent[s_name]</td>";
echo"<td>$htmlcontent[addr]</td></tr>";
}
// สร้างเนื้อหาจาก HTML code
$pdf->writeHTML($htmlcontent, true, 0, true, 0);
// เลื่อน pointer ไปหน้าสุดท้าย
$pdf->lastPage();
// ปิดและสร้างเอกสาร PDF
$pdf->Output('test.pdf', 'I');
?>
Tag : PHP, MySQL, CakePHP, Report Others
|
|
 |
 |
 |
 |
Date :
2013-08-28 17:43:25 |
By :
dringnakub |
View :
2333 |
Reply :
5 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
มันไม่ยอมแสดงซักที รบกวนช่วยด้วยนะครับ ผม มือใหม่ครับ
|
 |
 |
 |
 |
Date :
2013-08-28 17:44:15 |
By :
dringnakub |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
    ช่วยทีครับ ทำมาหลายวันแล้ว ยังไงก็ไม่ได้อะครับ
|
 |
 |
 |
 |
Date :
2013-08-28 22:03:29 |
By :
dringnakub |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
while($rs=mysql_fetch_array($qr)){
$htmlcontent.=$rs['username']."<br/>";
$htmlcontent.="<tr><td>$htmlcontent[sex]</td>";
$htmlcontent.="<td>$htmlcontent[n_name]- $htmlcontent[s_name]</td>";
$htmlcontent.="<td>$htmlcontent[addr]</td></tr>";
}
|
 |
 |
 |
 |
Date :
2013-08-29 05:43:57 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|