<?php
Include_once (DirName (__file__). /.. /inc/conn.php ');
Include_once (DirName (__file__). /.. /photo/inc/function.php ');
$Date = Date ("y-m-d");
$Filename = $Date. ' _ '. Date ("h_i_s"). ". CSV ";
$a = "account number, mailbox, sex, baby date of birth, province, real name, postcode, mobile phone, address RN";
Header ("Content-type:application/vnd.ms-excel");
Header ("Content-disposition:filename=". $Filename);
$SQL = "SELECT * from Oy_use";
$Result = mysql_query ($SQL) or Die (Mysql_error ());
while ($rs = Mysql_fetch_array ($Result)) {
if (Get_days ($rs [' m_time ']) <= $Table) {
$a. = $rs [' user_name ']. $rs [' User_mail ']. ",". ($rs [' User_baby_sex ']? Male ': ' Woman '). ",". $rs [' User_baby_birth ']. ",";
$a. = "". $rs [' Sheng ']. ",". $rs [' User_rname ']. ",". $rs [' User_zip ']. $rs [' User_hand ']. ",". $rs [' user_address ']. "RN";
// }
}
echo $a;
function Get_days ($base) {
$Date _1=date ("y-m-d");//format can also be: $Date _1= "2003-6-25 23:29:14";
$Date _2=substr ($base, 0,10);
$Date _list_a1=explode ("-", $Date _1);
$Date _list_a2=explode ("-", $Date _2);
Print_r ($Date _list_a2);
$d 1=mktime (0,0,0, $Date _list_a1[1], $Date _list_a1[2], $Date _list_a1[0]);
$d 2=mktime (0,0,0, $Date _list_a2[1], $Date _list_a2[2], $Date _list_a2[0]);
Echo Round ($d 1-$d 2)/3600/24), ' <br> ';
Return round ($d 1-$d 2)/3600/24);
}
?>