$times = time ();
$filename = $times. ". CSV ";
$a = "contact person, contact telephone number, application time";
$days = Postget ("Days");
$mktime = Daystomktime ($days);
$sql = "SELECT * from V_tugou where ($times-times) < $mktime";
$db = new db ();
$result = $db->query ($sql);
$rs = $db->fetch ($result, 0);
foreach ($rs as $v => $vv)
{
$a. = $vv [' name ']. $VV [' Mo ']. ",";
$a. =date (' y-m-d ', $vv [' Times ']). " ";
}
echo $a;
$hod = fopen ($filename, "w+");
if (fwrite ($hod, $a))
{
echo "Build Excel file successfully, click <a href= $filename target=_blank> Right click Save As Excel document </a>";
}
/*
Data
--
--The structure of the table ' Hn_tugou '
--
CREATE table if not EXISTS ' V_tugou ' (
' ID ' int (4) NOT NULL auto_increment,
' name ' varchar NOT NULL default ' 0 ',
' Mo ' varchar NOT null default ' 0 ',
' Times ' int (4) default NULL,
' IP ' varchar NOT NULL default ' 0 ',
Primary KEY (' ID ')
) Engine=myisam default Charset=utf8 auto_increment=2;
--
--Export the data in the table ' Hn_tugou '
--
Insert INTO ' Hn_tugou ' (' IDs ', ' name ', ' Mo ', ' Times ', ' IP ') values
(1, ' AdSense ', ' www.111cn.net ', 1283241159, ' 192.168.0.119 ');
This site original article reproduced annotated from http://www.111cn.net/phper/php.html
*/