|
|
|
จะดึงข้อมูลจากฐานข้อมูลมาแสดงในตารางครับ ผมจะดึงข้อมูลจากฐานข้อมูลมาแสดงในตารางครับ ..ทำไหมมันไม่มางะ |
|
|
|
|
|
|
|
ผมจะดึงข้อมูลจากฐานข้อมูลมาแสดงในตารางครับ ..ทำไหมมันไม่มางะครับ ผมเขียนผิดตรงไหนเหรอ..ครับ
<?php
require('thaipdfclass.php');
class PDF extends ThaiPDF
{
//Simple table
function BasicTable($header,$data)
{
//Header
foreach($header as $col)
$this->Cell(40,7,$col,1);
$this->Ln();
//Data
$cnt1 = 0;
while($cnt1 < count($data)) {
$cnt2 = 0;
while($cnt2 < count($data[$cnt1])) {
$this->Cell(40,6,$data[$cnt1][$cnt2],1);
$cnt2++;
}
$this->Ln();
$cnt1++;
}
}
}//end class
//header declare
$header=array('1','2','3','4','5','6','7');
//data query from database keep to array 2 dimension
$sql="select * from $prainfo";
$db_query=mysql_db_query($db,$sql);
$i=0;
while($arr) {
$data[$i][0] = $arr['name'];
$data[$i][1] = $arr['surname'];
$i++;
}
//create object pdf
$pdf = new PDF();
$pdf->SetThaiFont();
$pdf->SetFont('AngsanaNew','',14);
$pdf->AddPage();
$pdf->BasicTable($header,$data);
$pdf->Output();
?>
Tag : - - - -
|
|
|
|
|
|
Date :
24 พ.ค. 2551 15:34:54 |
By :
เต้ |
View :
1811 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เพิ่มเติมครับ บรรทัดนี้
//data query from database keep to array 2 dimension
include("config.php"); //เพิ่มมาครับ ก็ไม่เห็นมา
$sql="select * from $prainfo";
$db_query=mysql_db_query($db,$sql);
$i=0;
while($arr) {
$data[$i][0] = $arr['name'];
$data[$i][1] = $arr['surname'];
$i++;
}
|
|
|
|
|
Date :
24 พ.ค. 2551 15:38:50 |
By :
เต้ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|