Export and save the csvexcel file in phpmysql. Phpmysql exports and saves csvexcel files. this is a file I wrote when using php to export mysql database data and save it as a csv file, and provides download, the principle is very simple. in php mysql, export a csv excel file and save it. this is a file I wrote when I was using php scripts.
Php Tutorial mysql tutorial export csv excel file and save
This is a php ghost file I wrote in my own time.
*/
$ Times = time ();
$ Filename = $ times. ". csv ";
$ A = "contact, contact number, application time n ";
$ 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 ['M']. ",";
$ A. = date ('Y-m-D', $ vv ['Times']). "rn ";
}
// Echo $;
$ Hod = fopen ($ filename, "w + ");
If (fwrite ($ hod, $ ))
{
Echo "the excel file is generated successfully. right-click and choose save as excel file ";
}
/*
Data structure
--
-- Table structure 'hn _ tugou'
--
Create table if not exists 'V _ tugou '(
'Id' int (4) not null auto_increment,
'Name' varchar (20) not null default '0 ',
'Mo' varchar (20) not null default '0 ',
'Times 'int (4) default null,
'IP' varchar (20) not null default '0 ',
Primary key ('id ')
) Engine = myisam default charset = utf8 auto_increment = 2;
--
-- Export the table data 'hn _ tugou'
--
Insert into 'hn _ tugou' ('id', 'name', 'M', 'Times ', 'IP') values
(1, 'adsense ', 'www. bKjia. c0m', 1283241159, '192. 168.0.119 ');
This site Original article reprinted from http://www.bKjia. c0m/phper/php.html
*/
Http://www.bkjia.com/PHPjc/630804.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/630804.htmlTechArticlephp mysql export csv excel format file and save this is a I write in my own use of php export mysql database data saved as a csv file, and provide download, the principle is simple...