|
|
|
ชวยแก้ตรงนี้ให้หน่อยครับ......mysql_fetch_array():........... |
|
|
|
|
|
|
|
Code (PHP)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874"></head>
<body>
<?php
$hostname = "localhost";
$dbuser = "ecer";
$dbpassword = "2222";
$dbname = "ecer";
$conn=mysql_connect($hostname, $dbuser, $dbpassword) or die("Don't Connect Database");
mysql_select_db($dbname,$conn)or die("Don't Connect Database!!");
mysql_query("set NAMES tis620 ");
//require_once("../connectdb.php");
require('fpdf.php');
define('FPDF_FONTPATH','font/');
//$pdf=new PDF();
$pdf=new FPDF( 'L' , 'mm' ,'A4');
$pdf->AddFont('angsana','B','angsanab.php');
$pdf->AddFont('angsana','','angsana.php');
$t_id = "";
$sql = "SELECT ".students.".t_tell AS t_tell";
$sql .= " ,".students.".t_id AS t_id";
$sql .= " ,".students.".t_name AS t_name";
$sql .= " ,".students.".t_schid AS t_schid";
$sql .= " ,".students.".t_avid AS t_avid";
$sql .= " ,".schools.".sch_id AS sch_id";
$sql .= " ,".schools.".sch_name AS sch_name";
$sql .= " ,".activities.".av_id AS av_id";
$sql .= " ,".activities.".av_subject AS av_subject";
$sql .= " ,".certificates.".cc_id AS cc_id";
$sql .= " ,".certificates.".cc_avid AS cc_avid";
$sql .= " ,".certificates.".cc_year AS cc_year";
$sql .= " ,".certificates.".cc_date AS cc_date";
$sql .= " ,".certificates.".cc_no AS cc_no";
$sql .= " ,".certificates.".cc_start AS cc_start";
$sql .= " ,".certificates.".cc_end AS cc_end";
$sql .= " ,".certificates.".cc_text AS cc_text";
$sql .= " ,".certificates.".cc_pict AS cc_pict";
$sql .= " ,".certificates.".school AS school_name";
$sql .= " ,".certificates.".num_cer AS num_cer";
$sql.= " FROM ".students." ,".schools.",".activities .",".certificates;
$sql.= " WHERE ".students.".t_id=".$_GET[id] ;
$sql.= " AND ".students.".t_schid=".schools.".sch_id";
$sql.= " AND ".students.".t_avid=".activities.".av_id";
$sql.= " AND ".certificates.".cc_avid=".activities.".av_id";
$sql.= " ORDER BY name,lastname ASC";
//echo $sql; die();
//$conn = mysql_connect(hostname, dbuser, dbpassword) or die("Error Connect to Database");
//mysql_select_db(dbname,$conn);
//mysql_query("SET NAMES TIS620");
//mysql_query("SET character_set_results=tis620");
//mysql_select_db("pdfdbtest");
//$sql = "SELECT * FROM customer";
//echo $sql; die();
$result = mysql_query($sql);
while($row = mysql_fetch_array($result)){
//*** Table 1 ***//
$pdf->AddPage();
$pdf->Image("../".$row[cc_pict],0,0,300,0,'','');
//$pdf->Ln(35);
/* เริ่มต้น พิมพ์รายละเอียด */
$pdf->SetXY(10,0);
$pdf->SetFont('angsana','',16);
$pdf->Cell( 268 , 65 , "เลขที่ "."$row[start_title] " .thaiNumber("".$row[num_cer])." / " .thaiNumber("".$row[year])." " , 0 , 1 , 'R' );
$pdf->SetXY(10,58);
$pdf->SetFont('angsana','B',35);
$pdf->Cell( 0 , 55 , $row[title]."".$row[t_name]." ".$row[t_name], 0 , 1 , 'C' );
$pdf->SetXY(10,90);
$pdf->SetFont('angsana','B',20);
$pdf->Cell( 0 , 15 ,$row[school_name] , 0 , 1 , 'C' );
$pdf->SetFont('angsana','B',24);
$pdf->Cell( 0 , 10 , $row[ap]." " .$row[rpname], 0 , 1 , 'C' );
$pdf->SetFont('angsana','B',24);
$pdf->Cell( 0 , 10 ,$row[comp_name], 0 , 1 , 'C' );
//$school_id = $row[school_id];
$pdf->SetFont('angsana','B',22);
$pdf->Cell( 0 , 10 , "ระหว่างวันที่ " .thaiNumber("".$row[date_in])." - " .thaiNumber("".$row[date_out])." " .$row[dean]." " .thaiNumber("".$row[year]). "" , 0 , 1 , 'C' );
$pdf->SetFont('angsana','B',22);
$pdf->Cell( 0 , 10 , "ณ " .$row[place_to] , 0 , 1 , 'C' );
$pdf->SetFont('angsana','B',22);
$pdf->Cell( 0 , 10 , $row[text_ap] , 0 , 1 , 'C' );
$pdf->SetFont('angsana','B',22);
$pdf->Cell( 0 , 10 , "ให้ไว้ ณ วันที่ " .thaiNumber("".$row[for_date])." " .$row[for_dean]." พ.ศ. " .thaiNumber("".$row[year]). "" , 0 , 1 , 'C' );
//$pdf->SetFont('angsana','B',24);
//$pdf->Cell( 0 , 15 , 'ขอให้มีความสุข ความเจริญตลอดไป' , 0 , 1 , 'C' );
/* สิ้นสุด พิมพ์รายละเอียด */
}// end while pdf นักเรียน
/* ส่วนของ pdf ครู */
$pdf_file = "../BBL.AC.TH-ALONE-(".$_GET[id].").pdf";
//echo $pdf_file; die();
//include("createpdf_teacher.php");
mysql_close($conn);
$pdf->Output("../TRAIN_ALONE/TRAIN_ALONE/".$pdf_file,"F");
?>
<center>
<img src="../../../images/cer/white.jpg"><br>
<a href="../TRAIN_ALONE/TRAIN_ALONE/<?=$pdf_file?>"><img src="../../../images/cer/cer_get.jpg" title="โหลดเกียรติบัตร" border="0"></a><br>
หากมีปัญหาในการดาวน์โหลดเกียรติบัตร ให้ทำการ รีเฟรช หน้าเอกสาร PDF หรือ กด F5 ที่คีย์บอร์ด<br>
หลังจากโหลดเอกสารเกียรติบัตรได้แล้ว กรุณา บันทึกเก็บไว้ที่เครื่องคอมพิวเตอร์ของท่านด้วย
</center>
</body>
</html>
Tag : PHP, Ajax, jQuery, CakePHP
|
|
|
|
|
|
Date :
2014-09-22 10:00:45 |
By :
phuttawat |
View :
708 |
Reply :
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลงเฟคข้อมูลแล้วเอาไปคิวรี่ตรงๆกับ database ดูนะค่ะว่าออกค่าที่ตรงกับที่ต้องการไหม
เพราะ error นี้น่าจะเป็นที่คิวรี่นะค่ะ
|
|
|
|
|
Date :
2014-09-22 10:06:23 |
By :
LuckyStar |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอตัวอย่างที่ละเอียดหน่อยครับ
|
|
|
|
|
Date :
2014-09-22 10:20:20 |
By :
phuttawat |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ก๊อบคิวรี่เอาไปคิวรี่ใน phpmyadmin ดูก่อนว่ามันออกปะ ถ้าไม่ออกก็ผิดตรงนี้ละ แก้ให้มันถูก
Code (PHP)
$sql = "SELECT ".students.".t_tell AS t_tell";
027.
$sql .= " ,".students.".t_id AS t_id";
028.
$sql .= " ,".students.".t_name AS t_name";
029.
$sql .= " ,".students.".t_schid AS t_schid";
030.
$sql .= " ,".students.".t_avid AS t_avid";
031.
$sql .= " ,".schools.".sch_id AS sch_id";
032.
$sql .= " ,".schools.".sch_name AS sch_name";
033.
$sql .= " ,".activities.".av_id AS av_id";
034.
$sql .= " ,".activities.".av_subject AS av_subject";
035.
$sql .= " ,".certificates.".cc_id AS cc_id";
036.
$sql .= " ,".certificates.".cc_avid AS cc_avid";
037.
$sql .= " ,".certificates.".cc_year AS cc_year";
038.
$sql .= " ,".certificates.".cc_date AS cc_date";
039.
$sql .= " ,".certificates.".cc_no AS cc_no";
040.
$sql .= " ,".certificates.".cc_start AS cc_start";
041.
$sql .= " ,".certificates.".cc_end AS cc_end";
042.
$sql .= " ,".certificates.".cc_text AS cc_text";
043.
$sql .= " ,".certificates.".cc_pict AS cc_pict";
044.
$sql .= " ,".certificates.".school AS school_name";
045.
$sql .= " ,".certificates.".num_cer AS num_cer";
046.
047.
048.
$sql.= " FROM ".students." ,".schools.",".activities .",".certificates;
049.
$sql.= " WHERE ".students.".t_id=".$_GET[id] ;
050.
$sql.= " AND ".students.".t_schid=".schools.".sch_id";
051.
$sql.= " AND ".students.".t_avid=".activities.".av_id";
052.
$sql.= " AND ".certificates.".cc_avid=".activities.".av_id";
053.
$sql.= " ORDER BY name,lastname ASC";
|
|
|
|
|
Date :
2014-09-22 10:27:24 |
By :
ลองดู |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เป็นแบบนี้ครับ
|
|
|
|
|
Date :
2014-09-22 11:17:50 |
By :
phuttawat |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แก้ตามนี้ แล้วดู error
064.$result = mysql_query($sql) or die($sql . "<br>\n" . $mysql_error()) ;
|
|
|
|
|
Date :
2014-09-22 12:14:44 |
By :
Chaidhanan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แบบนี้ครับ
Fatal error: Function name must be a string in D:\AppServ\www\cer\CERTIFICATE\createpdf_train_alone.php on line 67
|
|
|
|
|
Date :
2014-09-22 12:18:37 |
By :
phuttawat |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|