lundi 14 octobre 2019

Am using to update the multiple rows in laravel but it give ne error

public function productUpdate(Request $request) {

    $product_id = $request->product_id;
$new_weight = $request->new_weight;
$id = array();
$name = array();
$query ='';
for ($i = 0; $i < count($product_id); $i++) {
  $id = $product_id[$i];

$name = $new_weight[$i]; if($name != 0){

// $query .= DB::statement("UPDATE acc_products SET prodweight = '$name' WHERE productid = '$id';")->toSql(); DB::table('acc_products')->where('productid', $id)->update(['prodweight'=>$name])->toSql();

}

}


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2VLzpcv
via IFTTT

Aucun commentaire:

Enregistrer un commentaire