Because the work needs today we want to export the data inside the MySQL database into Execel, and later found on the internet so simple, because the CSV file as long as the "," separate is OK, below we will take a look at the example bar.
Include (".. /inc/connect.php ");
$Date = Date ("y-m-d");
$Filename = $Date. ". CSV ";
$Table = isset ($_get[' tid '])? $_get[' Tid ']: ';
Header ("Content-type:application/vnd.ms-excel");
Header ("Content-disposition:filename=". $Filename);
echo "User name, real name, contact information, contact QQ, contact address, e-mail address RN";
$SQL = "SELECT * from Gx_member where DateDiff (M_time, '". Date ("Y-m-d h:i:s"). "') <= $Table ORDER BY id DESC ";
$Result = mysql_query ($SQL);
while ($rs = Mysql_fetch_array ($Result)) {
echo $rs [' M_name ']. ', '. $rs [' M_realname ']. ",". $rs [' M_tel ']. ",". $rs [' m_qq ']. ",". $rs [' m_address ']. ",". $rs [' M_mail ']. "RN";
}
?>
We used to export the CSV file and a kind of export XLS file as long as modified
Header ("Content-type:application/vnd.ms-excel");
Header ("Content-disposition:filename=". $Filename);
It's almost over.
This site original reprint please specify www.111cn.cn/phper/php.html
http://www.bkjia.com/PHPjc/630431.html www.bkjia.com true http://www.bkjia.com/PHPjc/630431.html techarticle because the work needs today we want to export the data inside the MySQL database into Execel, and later found on the internet so simple, because the CSV file as long as, separate OK, below I ...