1
我想回路數據插入到與laravel數據庫,但它返回以下錯誤:我想回路數據插入到數據庫中,但它給了一個錯誤
ErrorException in Grammar.php line 118: Argument 1 passed to Illuminate\Database\Grammar::parameterize() must be of the type array, string given, called in C:\xampp\htdocs\laravel\App\vendor\laravel\framework\src\Illuminate\Database\Query\Grammars\Grammar.php on line 678 and defined
查看:
<input name="product_id[]" type="hidden" class="rid" value="13">
<input type="hidden" name="product_name[]" value="Popins"><input type="hidden" name="product_code[]" value="2323">
<input name="unit_price[]" type="hidden" value="170">
<input name="quantity[]" type="text" value="2" id="" >
控制器
for($i=0; $i<count($product_name);$i++){
$newSafety = new saleItems;
$newSafety->product_id = $request->unit_price;
$newSafety->sale_id = $request->unit_price;
$newSafety->product_code = $request->product_code;
$newSafety->product_name = $request->product_name;
$newSafety->quantity = $request->quantity;
$newSafety->unit_price = $request->unit_price;
$newSafety->gross_total= $request->unit_price;
$newSafety->save();
}
哪個Laravel的版本您使用的?請不要TAG SPAM – RiggsFolly
哪些是** 678 **在** 12行**中**您已經向我們顯示 – RiggsFolly
@RiggsFolly使用的是laravel 5.2和Grammar.php,您所說的768行是laravel文件。我沒有做到 –