codeigniter ~ backup database |
seperti postingan cangkal sebelumnya export query ke csv sama halnya dasar CRUD sudah ada, data di database juga sudah ada. sekarang tinggal membuat button "backup db" sebelah button "csv" seperti gambar dibawah ini
backup database codeigniter |
echo anchor(site_url('ip/backupdb'), 'backup db', 'class="btn btn-primary"'); ?>setelah itu kita membuat fuction backupdb pada Controller Ip. codingnya seperti ini.
public function backupdb () { // Load the DB utility class $this->load->dbutil(); // Backup your entire database and assign it to a variable $backup = $this->dbutil->backup(); // nama file backup $namafile = "dbbackup". "-" . date("Y-m-d_H-i-s") . ".sql.gz"; // Load the file helper and write the file to your server $this->load->helper('file'); write_file(FCPATH .'/db_backup/'.$namafile, $backup); // Load the download helper and send the file to your desktop $this->load->helper('download'); force_download($namafile, $backup); }masing masing baris sudah cangkal beri komentar, semoga bisa dipahami.
setelah semua telah dilakukan, saatnya kita trial codingan kita sob, apabila muncul pesan download seperti ini
dan pada root directory /db_backup/ ada file seperti ini
selamat sob kamu sudah bisa cara backup database menggunakan framework codeingniter.
regards,
cangkal
Did you know there is a 12 word sentence you can communicate to your partner... that will trigger intense feelings of love and instinctual attractiveness to you deep within his heart?
BalasHapusBecause hidden in these 12 words is a "secret signal" that fuels a man's instinct to love, adore and look after you with all his heart...
12 Words That Fuel A Man's Love Response
This instinct is so hardwired into a man's brain that it will drive him to work harder than ever before to do his best at looking after your relationship.
Matter-of-fact, triggering this mighty instinct is absolutely binding to having the best possible relationship with your man that the moment you send your man a "Secret Signal"...
...You will instantly notice him open his mind and heart to you in a way he's never experienced before and he'll perceive you as the one and only woman in the galaxy who has ever truly appealed to him.