mysql - 无法在Mysql数据库laravel中插入超过53条记录
问题描述
我正在尝试将数据从 Excel 文件导入 MySQL 数据库,无论如何,当文件包含例如 100 条记录时,似乎只能导入 53 条记录,我不明白为什么,如果是,我可以从哪里扩展这个数字已经配置好了。
即使文件包含 54 条记录,它也只会导入 53 条。这似乎是固定数字,这是我的代码,它将从 excel 文件接收数据并将其插入数据库
$question_bank_id = $request->input('question_bank');
$tempQuestion = array();
foreach ($request["all_questions"] as $key => $value){
$request["all_questions"] = array($key => $value);
Var_dump($request["all_questions"]);
$$module_name_singular = $module_model::create($request->except('question_bank','earn_list'));
$$module_name_singular->earn()->attach($request->input('earn_list'));
array_push($tempQuestion,$$module_name_singular->id);
}
谢谢你
解决方案
你没有看到你正在写你正在循环的变量吗?
$question_bank_id = $request->input('question_bank');
$tempQuestion = array();
foreach ($request["all_questions"] as $key => $value){
// This next line destroys $request["all_questions"]
// which is the variable you are looping over
$request["all_questions"] = array($key => $value);
Var_dump($request["all_questions"]);
// next 3 line has `$$` and I dont think you ment to
$$module_name_singular = $module_model::create($request->except('question_bank','earn_list'));
$$module_name_singular->earn()->attach($request->input('earn_list'));
array_push($tempQuestion,$$module_name_singular->id);
}
推荐阅读
- r - 如何从 url 读取 IMF xls- 或 sdmx-data?
- javascript - 滚动锁定在移动设备上
- python - 取决于 Pandas Dataframe 列的值数组
- angular - 无法绑定到“dividerColor”,因为它不是“mat-form-field”的已知属性
- c++ - 在 unordered_map 的键上实现“你的意思是”
- reactjs - Ant-Design React-Native 搜索栏取消按钮在按下时无法隐藏
- node.js - 如何解决“TypeError: Cannot read property 'recordset' of undefined”的问题?
- python - 如何使用 jupyter notebook 在桌面上读取文件?
- php - PHP Imagick ReadImage WriteImage 质量不同
- javascript - 在 vuejs 中过滤 const 数据