Reputation: 21
I want to back up a database, which is successfully backed up, but content fail to be retrieved. For example is missing quotation marks.
public function backup()
{
$fileName=date("Y-m-d h:i:sa").".zip";
// Load the DB utility class
$this->load->dbutil();
$prefs = array(
'format' => 'zip',
'filename' => date("Y-m-d h:i:sa").'.sql',
'ignore' => array(),
'add_drop' => TRUE,
'add_insert' => TRUE,
'newline' => "\n"
);
// Backup your entire database and assign it to a variable
$backup =& $this->dbutil->backup($prefs);
// Load the file helper and write the file to your server
$this->load->helper('file');
write_file(FCPATH.'/downloads/'.$fileName, $backup);
// Load the download helper and send the file to your desktop
$this->load->helper('download');
force_download($fileName, $backup);
}
but the contents of the backup it received
INSERT INTO `product` (`urun_stok_kodu`, `urun_adi`, `urun_kat`) VALUES (1-100-10-5, Altıgen Yeşil 10luk, 1);
INSERT INTO `product` (`product_stock_code`, `product_name`, `product_menu`) VALUES (1-100-10-1, Altıgen Kahverengi 10luk, 1);
INSERT INTO `product` (`product_stock_code`, `product_name`, `product_menu`) VALUES (1-100-10-2, Altıgen Kırmızı 10luk, 1);
INSERT INTO `product` (`product_stock_code`, `product_name`, `product_menu`) VALUES (1-100-10-6, Altıgen Mavi 10luk, 1);
INSERT INTO `product` (`product_stock_code`, `product_name`, `product_menu`) VALUES (1-100-10-4, Altıgen Sarı 10luk, 1);
It is taking the backup in this way, but in fact :
INSERT INTO `product` (`product_stock_code`, `product_name`, `product_menu`) VALUES ('1-100-10-4', 'Altıgen Sarı 10luk', '1');
Do you know what could be the issue? Thanks.
Upvotes: 2
Views: 234