|
 |
|
สอบถามปัญหาคำสั่ง SQL ของ ใน fpdf เกี่ยวกับการเรียก วนลูป ค่า จากฐานข้อมูลออกมาแสดงทีละบรรทัด ต้องทำอย่างไร |
|
 |
|
|
 |
 |
|
คือผมต้องการดึงข้อมูลจากฐานข้อมูลออกมาแสดงในpdf แล้วมันออกมาแค่ค่าสุดท้ายครับ ออกมาบรรทัดเดียว ไม่ทราบว่าต้องแก้ตรงไหนอย่างไร รบกวนช่วยหน่อยนะครับ
<?php
include("./inc/connect.php");
include("./inc/config.php");
define('FPDF_FONTPATH', 'font/');
require('fpdf.php');
//**************** ข้อมูล ******************
//****************************************
//**************** โหลดข้อมูล **************
$strMonthCut = Array("","ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค.");
$today = getdate();
$dateReceipt = $today["mday"].'/'.$strMonthCut[$today["mon"]].'/'.($today["year"]+543);
$student_id=$_REQUEST[student_id];
$service_id=$_REQUEST[service_id];
$sql11="select * from service WHERE student_id='$student_id' && service_id='$service_id'";
$result11 = mysql_query($sql11,$connect);
$record11 = mysql_fetch_array($result11);
$reciept_no=$record11['reciept_no'];
//echo"$row";
//exit();
$sql5="select * from student WHERE student_id='$student_id'";
$result5=mysql_query($sql5,$connect);
$result5 = mysql_query($sql5,$connect);
$record5 = mysql_fetch_array($result5);
$row=mysql_num_rows($result5);
$title=iconv("UTF-8", "ISO-8859-11",$record5["title"]);
$name=iconv("UTF-8", "ISO-8859-11",$record5["name"]);
$surname=iconv("UTF-8", "ISO-8859-11",$record5["surname"]);
$sql="select * from service,equipment_service where service.service_id='$service_id' and equipment_service.service_id='$service_id'";
//echo "$sql";
//exit;
$result = mysql_query($sql,$connect);
$resultt = mysql_query($sql,$connect);
$row = mysql_fetch_array($resultt);
$row=mysql_num_rows($result);
if($row>0){
while($row = mysql_fetch_array($result)){
$num++;
$service_id=$row['service_id'];
$student_id=$row['student_id'];
$total=$row['total'];
$total2+=$row['total'];
$amount=$row['amount'];
$equlpment_id=$row['equlpment_id'];
$sql3="select * from equlpment where equlpment_id='$equlpment_id'";
$result3 = mysql_query($sql3,$connect);
$row3 = mysql_fetch_array($result3);
$category_service_id=$row3['category_service_id'];
//$equlpment_name=$row3['equlpment_name'];
$price_per_sheet=$row3['price_per_sheet'];
$equipment_name=iconv("UTF-8", "ISO-8859-11",$row3["equipment_name"]);
$sql4="select * from category_service where category_service_id='$category_service_id'";
$result4 = mysql_query($sql4,$connect);
$row4 = mysql_fetch_array($result4);
$category_service_name=iconv("UTF-8", "ISO-8859-11",$row4['category_service_name']);
}
}else{
}
//****************************************
//**************** สร้าง pdf ****************
$pdf = new FPDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->Image('images/001.jpg', 90.5, 8, 28);
$pdf->AddFont('angsana', '', 'angsa.php');
$pdf->SetFont('angsana', '', 16)ฃ
๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙๙;
ทำได้แล้วครับ
Tag : PHP, MySQL

|
ประวัติการแก้ไข 2011-06-11 00:06:09
|
 |
 |
 |
 |
Date :
2011-06-04 15:11:13 |
By :
NoteDeviLz |
View :
1291 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
fasfasfafaf
หกดหกดหกด
หกดหกดหกดหกดหก
ดหกดหกดหกดหก
ดหกดหกดหกดหก
ดหกดหกดหกดหกดหกดหก
ดหกดหกดหก
ดหกดหกดหกด
หกดหกดหกด
หกดหกดหกด
หกดหกดหกด
หกดหกดหก
ดหกดหก
ดหกดหกด
หกดหกด
หกดหกดหก
ด
|
 |
 |
 |
 |
Date :
2011-06-04 15:44:26 |
By :
หกดหก |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ก็ใน code fpdf ของนายมันไม่ได้ วน loop ตามข้างบนที่นายเขี่ยนนี่นา นายก็ต้องเขียนให้มันวนลูบตรง create pdf ดิ ไปวน loop ข้างบน
แล้วมันจะไปเขียนด้านล่างได้ไง มันก็เอาบรรทัดสุดท้ายมาโชว์ อ่ะดิ
|
ประวัติการแก้ไข 2011-06-04 16:39:17
 |
 |
 |
 |
Date :
2011-06-04 16:36:41 |
By :
yuyu7878 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|