新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
根據(jù)Mysql表備份
Mysql數(shù)據(jù)庫有多種的備份方法,下面為您介紹的方法是根據(jù)Mysql表備份,該方法供您參考,希望對(duì)您學(xué)習(xí)Mysql表備份數(shù)據(jù)庫方面能有所幫助。

- 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聯(lián)結(jié)查詢一覽
MySQL隨機(jī)查詢的優(yōu)化實(shí)例
MySQL排序使用情況
新聞名稱:根據(jù)Mysql表備份
鏈接URL:http://m.fisionsoft.com.cn/article/cdhiihp.html


咨詢
建站咨詢
