|
 |
|
ช่วยด้วยครับอยากทำ php ให้เป็น pdf โดยดึงข้อมูลมาจาก db |
|
 |
|
|
 |
 |
|
Code
<!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=windows-874" />
<title>Print Detail</title>
</head>
<body>
<?php
//include ('chksession.php');
include ('connect.php');
//include ('function.php');
mysql_query("SET NAMES TIS620");
$sql="select * from regis_member where Student_id='$_GET[Student_id]' ";
$result=mysql_query($sql);
$record=mysql_fetch_array($result);
$S_Name=$record['S_Name'];
$S_Mid=$record['S_Mid'];
$S_Sex=$record['S_Sex'];
$Student_id=$record['Student_id'];
$S_Type=$record['S_Type'];
$S_Degree=$record['S_Degree'];
$S_EDC=$record['S_EDC'];
$S_Level=$record['S_Level'];
$S_Room=$record['S_Room'];
$S_Major=$record['S_Major'];
$S_Born=$record['S_Born'];
$S_Blood=$record['S_Blood'];
$S_Ident_id=$record['S_Ident_id'];
$S_Address=$record['S_Address'];
$S_Phone=$record['S_Phone'];
$S_Email=$record['S_Email'];
$S_Picture=$record['S_Picture'];
// mysql_close();
?>
<?php
require('class/fpdf.php');
define('FPDF_FONTPATH','class/font/');
$pdf=new FPDF();
$pdf->AddPage();
$pdf->AddFont('angsa','','angsa.php');
$pdf->SetFont('angsa','',36);
$pdf->Cell(0,10,'..................................',0,1,"C");
$pdf->Cell(0,10,'รหัส......................................',0,1,"L");
$pdf->Cell(0,10,'ชื่อ-สกุล',0,1,"L");
$pdf->Cell(0,10,'ปี....................................',0,1,"L");
$pdf->Output("MyPDF/รหัส.pdf","F");
?>
Click <a href="MyPDF/รหัส.pdf">here</a> to Download
</body>
</html>
โดยที่ตัวอักษรสีแดงคือดึงข้อมูลมาจาก db และมีการแยกไฟล์ที่สร้างขึืนมาตามรหัสครับ ขอบคุณครับ
Tag : PHP, MySQL

|
|
 |
 |
 |
 |
Date :
2012-05-24 14:48:58 |
By :
comsc006 |
View :
1037 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
$pdf->Cell(0,10,'รหัส..............$Student_id........................',0,1,"L");
แบบนี้ไม่ได้เหรอครับ
|
 |
 |
 |
 |
Date :
2012-05-24 15:12:22 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
$pdf->Cell(0,10,"รหัส..............$Student_id........................",0,1,"L");
แก้ไขใหม่จาก ' เป็น " ครับ
|
 |
 |
 |
 |
Date :
2012-05-24 16:08:17 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|