zoukankan      html  css  js  c++  java
  • MySQL备份之根据表备份概述

    以下的文章主要向大家介绍的是MySQL备份之根据表备份,本文主要是以实际应用代码的方式来引出MySQL备份之根据表备份,下面就是文章的主要内容描述,希望会给你带来一些帮助在此方面。

    1. <?php 
    2. function datatosql($table)   
    3. {   
    4. global $db;   
    5. $tabledump = "DROP TABLE IF EXISTS $table; ";   
    6. $createtable = $db->query("SHOW CREATE TABLE $table");   
    7. $create = $db->fetch_array($createtable);   
    8. $tabledump .= $create[1]."; ";   
    9. $rows = $db->query("SELECT * FROM $table");   
    10. $numfields = $db->num_fields($rows);   
    11. $numrows = $db->num_rows($rows);   
    12. while ($row = $db->fetch_array($rows)){   
    13. $comma = "";   
    14. $tabledump .= "INSERT INTO $table VALUES(";   
    15. for($i = 0; $i < $numfields; $i++)   
    16. {   
    17. $tabledump .= $comma."'".MySQL_escape_string($row[$i])."'";   
    18. $comma = ",";   
    19. }   
    20. $tabledump .= "); ";   
    21. }   
    22. $tabledump .= " ";   
    23. return $tabledump;   
    24. }  

    以上的相关内容就是对MySQL备份之-根据表备份的介绍,望你能有所收获。

    MySQL备份

    以上的相关内容就是对MySQL备份之-根据表备份的介绍,望你能有所收获。

  • 相关阅读:
    python的基本操作while循环体
    python中类的神奇方法应用案例
    Python中类的神奇方法
    python 中类的初始化方法
    Python中类的创建和self的作用
    投掷骰子的游戏,键值对
    字典常用方法
    剪刀石头布
    math 模块
    PYTHON内置模块
  • 原文地址:https://www.cnblogs.com/syncnavigator/p/10198267.html
Copyright © 2011-2022 走看看