All countries
178,668,275
Covid-19 Statistic
Updated on June 19, 2021 11:16 am

Auto Backup Database Mysql Menggunakan PHP

Popular

Terungkap Cara Pelaku Dapat Video Syur Mirip Gisel 19 Detik Sebelum Disebarkan di Medsos

Terungkap Cara Pelaku Dapat Video Syur Mirip Gisel 19 Detik Sebelum Disebarkan di Medsos - Setelah beredar luas dan viral video syur mirip artis...

Dominasi Netflix di Peta (Grafik Data) Saat ini Tidak Tersedia di China

Berdasarkan data yang kami miliki untuk 66 negara, kami menemukan bahwa Netflix adalah pemimpin pasar di 61 negara. Prime Video memimpin di Jerman, Austria dan India. BluTV memimpin di Turki dan iQiyi di Cina. Perhatikan bahwa Netflix saat ini tidak tersedia di China.

Eja Sutejahttp://Lambeteja.com
Hallo Gaes, Kenalin Nama Saya Suteja, Saya Kelahiran Kuningan Sekarang Domisili di Cirebon. Saya Berselancar Bebas Sambil Mencari Harta Karun, Kebetulan Saya Sangat Menyukai Dunia Sosialmedia untuk Mencari Pundi Pundi, Saya Berpengalaman hampir dari 2010.




Langkah pertama teman-teman buat file dengan nama backup.php untuk membuat function backup seperti pada script di bawah ini.


while($row = $result->fetch_row()){
$tables[] = $row[0];
}
}else{
$tables = is_array($tables)?$tables:explode(',',$tables);
}
//Loop melalui Table
foreach($tables as $table){
$result = $db->query("SELECT * FROM $table");
$numColumns = $result->field_count;
$return .= "DROP TABLE $table;";
$result2 = $db->query("SHOW CREATE TABLE $table");
$row2 = $result2->fetch_row();
$return .= "\n\n".$row2[1].";\n\n";
for($i = 0; $i < $numColumns; $i++){ while($row = $result->fetch_row()){
$return .= "INSERT INTO $table VALUES(";
for($j=0; $j < $numColumns; $j++){
$row[$j] = addslashes($row[$j]);
$row[$j] = ereg_replace("\n","\\n",$row[$j]);
if (isset($row[$j])) { $return .= '"'.$row[$j].'"' ; } else { $return .= '""'; }
if ($j < ($numColumns-1)) { $return.= ','; }
}
$return .= ");\n";
}
}
$return .= "\n\n\n";
}
//simpan file , alamat penyimpanan dan nama file
$handle = fopen('backup/webbackup.sql','w+');
fwrite($handle,$return);
fclose($handle);
}

Jika sudah maka tahap selanjutnya teman-teman buat file dengan nama index.php yang berisi script untuk melooping function yang sudah di buat sebelumnya.


<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>

<script>
function backupDatabaseTables(){
$.get("backup.php", function(){
})
setTimeout(backupDatabaseTables, 500000);
}
backupDatabaseTables();
</script>



More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

Clarice Season 1 Season 13 Finale Promo

Clarice 1x13 "Family is Freedom" Season 1 Episode 13 Promo (Season Finale) - On the heels of ViCAP uncovering Alastor’s secrets, Clarice is imprisoned in an animal testing facility where she finds trafficked women being held captive. ViCAP and Ardelia team up to locate Clarice as she attempts to break from her captors in a race to rescue the other women, on the season finale of CLARICE, Thursday, June 24th on CBS.

[S4E7] Dynasty Season 4, episode 7 – Watch Online & Release Date

Will you be watching the "Dynasty s4~e7" live or catch it later this week? We always tune in live so we can watch along with all the fans.

How to watch Canadiens vs. Golden Knights Game 3 “Semifinals series”

Canadiens vs. Golden Knights Round 3 Game 3: Preview, start time, Tale of the Tape, and how to watch

Vegas Golden Knights at Montreal Canadiens – Game 3 (NHL Playoffs)

Mamang Teja - Vegas Golden Knights at Montreal Canadiens – Game 3 (NHL Playoffs) on Layarstar - These searches should lead you to a blog’s guest post guidelines page, guest post submission page, or actual guest posts by other writers. Author: Mamang Teja Title: Vegas Golden Knights at Montreal Canadiens – Game 3 (NHL Playoffs)

NHL Playoffs: Vegas Golden Knights at Montreal Canadiens – Game 3 (USA Network)

The Montreal Canadiens and Vegas Golden Knights face off in the semifinal round for the 2021 Stanley Cup Playoffs. We break down what to watch and how to watch on TV and via live online stream.

How to watch Canadiens vs. Golden Knights in Stanley Cup Semifinals series

The Stanley Cup Semifinals are upon us as the 2021 NHL Playoffs have moved into the final four. This year’s playoffs feature a different structure due to the COVID-19 pandemic. The

Hawks look for series win at home vs. 76ers in Game 6 “Preview”

Preview: Hawks look for series win at home vs. 76ers in Game 6 The Atlanta Hawks, somehow, simply have to win one game on their...