|
本帖最后由 bax 于 2013-3-16 00:00 编辑
照理來說是可行,但是找了很多方法都不是很了解操作方式,我希望的是有一個界面,可以把我之前導出來備份的文件執行一次...
可以的話,能傳回%進度 更好...
補充:文件檔案若是大過服務器限制,有辦法先上傳再自動切割分批執行嗎
這裡找到接近的代碼,但是執行後出現下面的錯誤...但是數據庫有成功insert
A Database Error OccurredThe query you submitted is not valid. Filename: D:\xampp\htdocs\app\system\database\DB_driver.php Line Number: 257 控制器
- $file = $this->load->file('filepath/filename.txt', true);
- //explode it in an array
- $file_array = explode(';', $file);
- //execute the exploded text content
- foreach($file_array as $query)
- $this->db->query($query);
复制代码 我的filename.txt 文件內容
- INSERT INTO od VALUES("24","1","2","0","31");
- INSERT INTO od VALUES("25","1","1","2","31");
- INSERT INTO od VALUES("26","1","4","0","156");
复制代码 |
|