excel|生成excel
header("Content-type:application/vnd.ms-excel");
header("Content-Disposition:filename=test.xls");
$sql = "select ";
if ( $ HTTP_POST_VARS["C1"] == "ON" ) $sql .= "hdid, ";
if ( $C2 == "ON" ) $sql .= "location, ";
if ( $C3 == "ON " ) $sql .= "getip, ";
if ( $C4 == "ON" ) $sql .= "type, ";
if ( $C5 == "ON" ) $sql .= "pcusername, " ;
if ( $C6 == "ON" ) $sql .= "ユーザーグループ, ";
if ( $C7 == "ON" ) $sql .= "ram, ";
if ( $C8 == "ON " ) $sql .= "cpu, ";
if ( $C9 == "ON" ) $sql .= "ディスク, ";
if ( $C10 == "ON" ) $sql .= "lanmac, " ;
if ( $C11 == "ON" ) $sql .= "モニター, ";
if ( $C12 == "ON" ) $sql .= "attachhd, ";
if ( $C13 == "ON " ) $sql .= "ソフトウェア, ";
if ( $C14 == "ON" ) $sql .= "ウェブログ, ";
if ( $C15 == "ON" ) $sql .= "その他 ";
if ( substr($sql, -2) == ", " ) $sql = substr($sql, 0, strlen($str)-2) 。 " ";
$sql .= "hdid ascによるpcinfoからの注文";
$link = mysql_connect('127.0.0.1','root','0000') or die("無法連線!連絡請管理者!」);
mysql_select_db('hdinfo',$link) または die("無法連到資料庫!請連絡管理者!");
//echo $sql;
$result = mysql_query("$sql");
$total=mysql_num_rows($result);
//echo $total;
if ( $HTTP_POST_VARS["C1" ] == "ON" ) echo "ハードウェア编号t";
if ( $C2 == "ON" ) echo "所属厂别t";
if ( $C3 == "ON" ) echo "所割り当てのIPt ";
if ( $C4 == "ON" ) echo "机器型号t";
if ( $C5 == "ON" ) echo "使用者名t";
if ( $C6 == "ON" ) echo "使用者部门t";
if ( $C7 == "ON" ) echo "内部存在構成t";
if ( $C8 == "ON" ) echo "CPU構成t";
if ( $C9 = = "ON" ) echo "硬盘配置t";
if ( $C10 == "ON" ) echo "网卡型号及MACt";
if ( $C11 == "ON" ) echo "显表示器型号t";
if ( $C12 == "ON" ) echo "その所に取り付けられたハードウェアt";
if ( $C13 == "ON" ) echo "所に取り付けられた软件t";
if ( $C14 == "ON" ) echo "上网申请纪录t";
if ( $C15 == "ON" ) echo "その他t";
echo " tn";
for ($i=0 ;$i<$total; $i++)
{
$result_row=mysql_fetch_row($result);
while (list($no,$content)=each($result_row))
{
echo "$contentt";
}
echo " tn";
}
以上は異なる選択に基づいて異なる列を基にしてExcelのファイルを生成します