Lestah
7 months ago
47
12
Laravel

What does it mean Undefined offset: 1

Posted 7 months ago by Lestah

I'm just trying to insert data on my cart table like this


$sizeIDArr = explode('-',$data['size']);
$product_size = $sizeIDArr[1]; //this the line that's giving me error

DB::table('cart')->insert(['product_id'=>$data['product_id'],'product_name'=>$data['product_name'],'product_code'=>$getSKU['sku'],'product_color'=>$data['product_color'],'price'=>$data['price'],'size'=>$product_size,'quantity'=>$data['quantity'],'user_email'=>$data['user_email'],'session_id'=>$session_id ]);

Please sign in or create an account to participate in this conversation.