Excel| Build 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 ($C 2 = "on") $sql. = "Location,";
if ($C 3 = "on") $sql. = "GetIP,";
if ($C 4 = "on") $sql. = "type,";
if ($C 5 = "on") $sql. = "Pcusername,";
if ($C 6 = "on") $sql. = "UserGroup,";
if ($C 7 = "on") $sql. = "Ram,";
if ($C 8 = "on") $sql. = "CPU,";
if ($C 9 = "on") $sql. = "Disk,";
if ($C = = "on") $sql. = "Lanmac,";
if ($C = = "on") $sql. = "Monitor,";
if ($C = = "on") $sql. = "Attachhd,";
if ($C = = "on") $sql. = "Software,";
if ($C = = "on") $sql. = "Weblog,";
if ($C = = "on") $sql. = "other";
if (substr ($sql,-2) = = ",") $sql = substr ($sql, 0, strlen ($STR)-2). " ";
$sql. = "from Pcinfo ORDER by hdid ASC";
$link = mysql_connect (' 127.0.0.1 ', ' root ', ' 0000 ') or Die ("Can't connect!");
mysql_select_db (' Hdinfo ', $link) or Die ("not connected to the library!)
Echo $sql;
$result = mysql_query ("$sql");
$total =mysql_num_rows ($result);
Echo $total;
if ($HTTP _post_vars["C1"] = = "on") echo "hardware number \ t";
if ($C 2 = "on") echo "Factory T";
if ($C 3 = "on") echo "ip\t assigned";
if ($C 4 = "on") echo "machine Model T";
if ($C 5 = "on") echo "user name \ t";
if ($C 6 = "on") echo "user department \ T";
if ($C 7 = "on") echo "Memory configuration \ T";
if ($C 8 = "on") echo "CPU configuration \ t";
if ($C 9 = "on") echo "HDD configuration \ T";
if ($C = = "on") echo "network card model and mac\t";
if ($C = = "on") echo "monitor model \ T";
if ($C = = "on") echo "its attached hardware \ t";
if ($C = = "on") echo "installed software \ T";
if ($C = = "on") echo "online application record \ T";
if ($C = = "on") echo "other \ T";
echo "\t\n";
for ($i =0; $i < $total; $i + +)
{
$result _row=mysql_fetch_row ($result);
while (list ($no, $content) =each ($result _row))
{
echo "$content \ T";
}
echo "\t\n";
}
The above is to query different columns based on different options, and then generate Excel files