|
 |
|
มีเรื่องให้ช่วยหน่อยนะครับ เรื่อง export มาเป็น excel |
|
 |
|
|
 |
 |
|
ใช้ "Col1","Col2" แทนครับ
|
 |
 |
 |
 |
Date :
2009-03-13 09:48:25 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
รบกวนพี่วินรีกรอบครับ ผมไม่เข้าใจเท่าไร พี่วินลองดูโค้ดให้ผมหน่อยนะ หรือใครก็ได้ช่วยที่ครับ
<?
header('Content-type: application/csv');
header('Content-Disposition: attachment; filename="leave.csv"');
include("../connect.php");
require_once('../connect2.php');
$report_1=$_POST[report_1];
$report_2=$_POST[report_2];
$tbname1="data_round";
$round_id=1;
$sql2="SELECT * FROM $tbname1 where round_id = $round_id";
$result2=mysql_query($sql2, $link);
while($row2 = mysql_fetch_row($result2))$round_1=$row2[1];
echo "รหัสพนักงาน,วันที่ลาหยุด,หยุดถึงวันที่,รวมวันที่หยุด,สาเหตุในการลา,ใบรับรองแพทย์,แผนก,ผู้ยื่นใบลา,ยื่นใบลาวันที่,ผู้อนุมัติใบลา,วันที่อนุมัติใบลา,ผู้ตรวจใบลา,วันที่ตราจใบลา,หมายเหตุ,\n";
$sql = "select * from sick_leave where $report_1 like '%$report_2%' && round=$round_1";
$dbquery = mysql_query($sql);
$num_rows = mysql_num_rows($dbquery);
$i=0;
while ($i < $num_rows)
{
$result= mysql_fetch_array($dbquery);
echo "$result[1],$result[2],$result[3],$result[5],$result[4],$result[10],$result[14],$result[7],$result[6],$result[8],$result[9],$result[11],$result[12],$result[15],\n";
$i++;
}
?>
|
 |
 |
 |
 |
Date :
2009-03-13 10:12:49 |
By :
นักเรียน |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 05
|