Author: mydowns Source: Seize time website: http://www.85time.com, http://www.mydowns.com
The original sticker address is as follows:
Http://www.mydowns.com/article_show.php?id=32
The detailed contents are as follows:
$DB _server = "localhost";
$DB _username = "mydowns";
$DB _password = "";
$DB _dbname = "mydowns";
$DB _tblname = "user";
$Connect = @mysql_connect ($DB _server, $DB _username, $DB _password)
Or Die ("couldn ' t connect.");
$Db = @mysql_select_db ($DB _dbname, $Connect)
Or Die ("couldn ' t select Database.");
$file _type = "Vnd.ms-excel";
$file _ending = "xls";
Header ("content-type:application/$file _type");
Header ("content-disposition:attachment; filename=mydowns. $file _ending ");
Header ("Pragma:no-cache");
Header ("expires:0");
$now _date = Date (' y-m-d h:i ');
$title = "Database name: $DB _dbname, Data sheet: $DB _tblname, Backup date: $now _date";
$sql = "SELECT * from $DB _tblname";
$ALT _db = @mysql_select_db ($DB _dbname, $Connect)
Or Die ("couldn ' t Select Database");
$result = @mysql_query ($sql, $Connect)
Or Die (Mysql_error ());
Echo ("$title");
$sep = "";
for ($i = 0; $i < Mysql_num_fields ($result); $i + +) {
Echo Mysql_field_name ($result, $i). "";
}
Print ("");
$i = 0;
while ($row = Mysql_fetch_row ($result))
{
$schema _insert = "";
for ($j =0; $j
{
if (!isset ($row [$j]))
$schema _insert. = "NULL". $sep;
ElseIf ($row [$j]! = "")
$schema _insert. = "$row [$j]". $sep;
Else
$schema _insert. = "". $sep;
}
$schema _insert = Str_replace ($sep. " $ "," ", $schema _insert);
$schema _insert. = "";
Print (Trim ($schema _insert));
Print "";
$i + +;
}
return (true);
?>
http://www.bkjia.com/PHPjc/445165.html www.bkjia.com true http://www.bkjia.com/PHPjc/445165.html techarticle Author: mydowns Source: Seize time website: http://www.85time.com, http://www.mydowns.com the original address is as follows: Http://www.mydowns.com/article_ SHOW.PHP?ID=32 details are as follows: PHP $DB ...