Mysql数据库有多种的备份方法,下面为您介绍的方法是根据Mysql表备份,该方法供您参考,希望对您学习Mysql表备份数据库方面能有所帮助。

- function datatosql($table)
 - {
 - global $db;
 - $tabledump = "DROP TABLE IF EXISTS $table;\n";
 - $createtable = $db->query("SHOW CREATE TABLE $table");
 - $create = $db->fetch_array($createtable);
 - $tabledump .= $create[1].";\n\n";
 - $rows = $db->query("SELECT * FROM $table");
 - $numfields = $db->num_fields($rows);
 - $numrows = $db->num_rows($rows);
 - while ($row = $db->fetch_array($rows)){
 - $comma = "";
 - $tabledump .= "INSERT INTO $table VALUES(";
 - for($i = 0; $i < $numfields; $i++)
 - {
 - $tabledump .= $comma."'".mysql_escape_string($row[$i])."'";
 - $comma = ",";
 - }
 - $tabledump .= ");\n";
 - }
 - $tabledump .= "\n";
 - return $tabledump;
 - }
 - ?>
 
【编辑推荐】
MySQL Show语句用法介绍
七种Mysql表类型
MySQL联结查询一览
MySQL随机查询的优化实例
MySQL排序使用情况
                当前题目:根据Mysql表备份
                
                转载来源:http://www.csdahua.cn/qtweb/news43/361743.html
            
网站建设、网络推广公司-快上网,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 快上网