PHP
—
数据库 php 备份数据库代码(生成
word,excel,json,xml,sql)
本文是对 php 备份数据库代码(生成 word,excel,json,xml,sql)进行了详细的分析介绍,供大
家参考下
单表备份
代码:
代码如下:
<?php
class
Db
{
var
$conn
;
function
Db(
$host
="localhost",
$user
="root",
$pass
="root",
$db
="test")
{
if
(!
$this
->conn=mysql_connect(
$host
,
$user
,
$pass
))
die
("can't connect to mysql sever");
mysql_select_db(
$db
,
$this
->conn);
mysql_query("SET NAMES 'UTF-8'");
}
function
execute(
$sql
)
{
return
mysql_query(
$sql
,
$this
->conn);
}
function
findCount(
$sql
)
{
$result
=
$this
->execute(
$sql
);
return
mysql_num_rows(
$result
);
}
function
findBySql(
$sql
)