📄 toexcel.php
字号:
<?php
header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=view_list.xls");
header("Pragma: no-cache");
header("Expires: 0");
include ("../inc/db.php");
include ("../inc/phpmkrfn.php");
$t_AUTOID=$_GET['AUTOID'];
if (empty($t_AUTOID)){$t_AUTOID=0;};
$conn = phpmkr_db_connect(HOST, USER, PASS, DB, PORT);
$sSql ="select shdmast.*,accounts.ACC01 from shdmast LEFT JOIN accounts ON shdmast.SHM02 = accounts.ID where shdmast.AUTOID= $t_AUTOID ";
$rs = phpmkr_query($sSql,$conn) or die("Failed to execute query: " . phpmkr_error() . '<br>SQL: ' . $sSql);
//xlsBOF(); // begin Excel stream
$row = mysql_fetch_array($rs, MYSQL_ASSOC);
$deltid=$row[SHMID]; //送货明细编号
echo $row[ACC01]."\t";
echo $row[SHM01]."\t";
echo $row[SHMID]."\t";
$sSql ="select * from shddelt where shdid='".$deltid."'";
$rs = phpmkr_query($sSql,$conn) or die("Failed to execute query: " . phpmkr_error() . '<br>SQL: ' . $sSql);
$i=1; //ROWNUM 行数
while($row = mysql_fetch_array($rs, MYSQL_ASSOC)){
//echo $row[SHD02];
$i=$i+1;
};
//xlsWriteLabel(0,0,"This is a label"); // write a label in A1, use for dates too
//xlsWriteNumber(0,1,9999); // write a number B1
//xlsEOF(); // close the stream
function xlsBOF() {
echo pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0);
return;
}
function xlsEOF() {
echo pack("ss", 0x0A, 0x00);
return;
}
function xlsWriteNumber($Row, $Col, $Value) {
echo pack("sssss", 0x203, 14, $Row, $Col, 0x0);
echo pack("d", $Value);
return;
}
// Function to write a label (text) into Row, Col
function xlsWriteLabel($Row, $Col, $Value ) {
$L = strlen($Value);
echo pack("ssssss", 0x204, 8 + $L, $Row, $Col, 0x0, $L);
echo $Value;
return;
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -